-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3313090
commit e060110
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { test } from "rollwright"; | ||
import { expect } from "@playwright/test"; | ||
import alias from "@rollup/plugin-alias"; | ||
|
||
test.use({ | ||
plugins: [ | ||
alias({ | ||
entries: [ | ||
{ | ||
find: /(react|react-dom)(\/.+|$)/, | ||
replacement: "https://esm.sh/[email protected]$2", | ||
customResolver: (id) => ({ id, external: true }), | ||
}, | ||
], | ||
}), | ||
], | ||
}); | ||
|
||
test("external", async ({ execute, page }) => { | ||
let root = await execute(async () => { | ||
let { createRoot } = await import("react-dom/client"); | ||
let section = document.createElement("section"); | ||
document.body.append(section); | ||
let root = createRoot(section); | ||
return root; | ||
}); | ||
|
||
await execute(async (root) => { | ||
let { jsx } = await import("react/jsx-runtime"); | ||
root.render(jsx("h1", { children: "Hello" })); | ||
}, root); | ||
|
||
await expect(page.locator("h1")).toContainText("Hello"); | ||
}); |