Skip to content

Commit

Permalink
chore: update tests for compatibility with Vite 6 (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored May 20, 2024
1 parent 59efc9b commit 8f5d9a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion playground/hmr/__tests__/hmr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test("HMR invalidate", async ({ page }) => {
await waitForLogs(
"[vite] invalidate /src/TitleWithExport.tsx: Could not Fast Refresh (export removed)",
"[vite] hot updated: /src/App.tsx",
"[hmr] Failed to reload /src/App.tsx. This could be due to syntax errors or importing non-existent modules. (see errors above)",
/Failed to reload \/src\/App\.tsx. This could be due to syntax errors or importing non-existent modules\. \(see errors above\)$/,
);

// Remove usage from App
Expand Down
10 changes: 8 additions & 2 deletions playground/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ export const setupWaitForLogs = async (page: Page) => {
page.on("console", (log) => {
logs.push(log.text());
});
return (...messages: string[]) =>
return (...messages: (string | RegExp)[]) =>
expect
.poll(() => {
if (messages.every((m) => logs.includes(m))) {
if (
messages.every((m) =>
typeof m === "string"
? logs.includes(m)
: logs.some((l) => m.test(l)),
)
) {
logs = [];
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports.default = react;`,
copyFileSync("README.md", "dist/README.md");

execSync(
"tsc src/index.ts --declaration --emitDeclarationOnly --outDir dist --module es2020 --moduleResolution bundler",
"tsc src/index.ts --declaration --emitDeclarationOnly --outDir dist --target es2020 --module es2020 --moduleResolution bundler",
{ stdio: "inherit" },
);

Expand Down

0 comments on commit 8f5d9a0

Please sign in to comment.