Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: NPM Publish

on:
push:
tags: v*
tags: [v*]
Copy link
Contributor Author

@ocavue ocavue Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer:

Here is a small tweak that's not related to this PR. tags should be an array. See example: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-branches-and-tags


jobs:
build:
Expand All @@ -18,9 +18,6 @@ jobs:
run: yarn --frozen-lockfile
- name: Build
run: yarn build
# Tests are failing on ubuntu-latest runners while windows-latest runners can't run NPM publish
# - name: Test
# run: yarn test
- name: Publish
uses: JS-DevTools/npm-publish@v2
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:

jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18", "20", "22"]
name: Test on Node.js ${{ matrix.node }}
node: ["16", "18", "20", "22", "24"]
os: ["windows-latest", "ubuntu-latest"]
runs-on: ${{ matrix.os }}
name: Test on Node.js ${{ matrix.node }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup node
Expand Down
31 changes: 16 additions & 15 deletions e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import fs from "fs";
import type { AddressInfo } from "net";

import { jest } from "@jest/globals";
import { firefox, chromium } from "playwright";
import { chromium } from "playwright";

import type { RollupOutput } from "rollup";
import vitePluginWasm from "../src/index.js";
Expand Down Expand Up @@ -62,7 +62,7 @@ async function buildAndStartProdServer(
},
cacheDir: path.resolve(tempDir, ".vite"),
plugins: [
...(modernOnly ? [] : [vitePluginLegacy()]),
...(modernOnly ? [] : [vitePluginLegacy({renderModernChunks: false})]),
vitePluginWasm(),
...(transformTopLevelAwait ? [vitePluginTopLevelAwait()] : [])
],
Expand Down Expand Up @@ -128,15 +128,8 @@ async function startDevServer(tempDir: string, vitePackages: VitePackages): Prom
return `http://localhost:${listeningAddress.port}`;
}

async function createBrowser(modernBrowser: boolean) {
return modernBrowser
? await chromium.launch()
: await firefox.launch({
firefoxUserPrefs: {
// Simulate a legacy browser with ES modules support disabled
"dom.moduleScripts.enabled": false
}
});
async function createBrowser() {
return await chromium.launch();
}

async function runTest(
Expand All @@ -159,7 +152,7 @@ async function runTest(
modernBrowser
);

const browser = await createBrowser(modernBrowser);
const browser = await createBrowser();
const page = await browser.newPage();

page.goto(server);
Expand Down Expand Up @@ -231,8 +224,16 @@ export function runTests(viteVersion: number, importVitePackages: () => Promise<
await runTestWithRetry(await importVitePackages(), false, true, true);
});

it(`vite ${viteVersion}: should work on legacy browser`, async () => {
await runTestWithRetry(await importVitePackages(), false, true, false);
});
if (viteVersion < 4) {
// We need the `renderModernChunks` option in `@vitejs/plugin-legacy` to
// simulate a legacy browser. This option is not available in older
// versions of `@vitejs/plugin-legacy`.
it(`vite ${viteVersion}: skipped on legacy browser`, async () => {});
return;
} else {
it(`vite ${viteVersion}: should work on legacy browser`, async () => {
await runTestWithRetry(await importVitePackages(), false, true, false);
});
}
});
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build": "tsc",
"test": "cross-env NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage --forceExit",
"format": "prettier --write '**/*.{mjs,cjs,js,mts,cts,ts}'",
"pretest": "yarn --cwd e2e && playwright install firefox && playwright install chromium"
"pretest": "yarn --cwd e2e && playwright install chromium"
},
"packageManager": "[email protected]",
"devDependencies": {
Expand All @@ -48,8 +48,7 @@
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"mime": "^4.0.6",
"playwright": "1.23.3",
"playwright-core": "1.23.3",
"playwright": "1.53.1",
"prettier": "^3.4.2",
"terser": "^5.37.0",
"ts-jest": "^29.2.5",
Expand Down
25 changes: 16 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2579,6 +2579,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

[email protected]:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
Expand Down Expand Up @@ -3761,17 +3766,19 @@ pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"

playwright-core@1.23.3:
version "1.23.3"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.23.3.tgz#f27ad80fbf0ba9b53d142d94f052b010eaa0527b"
integrity sha512-x35yzsXDyo0BIXYimLnUFNyb42c//NadUNH6IPGOteZm96oTGA1kn4Hq6qJTI1/f9wEc1F9O1DsznXIgXMil7A==
playwright-core@1.53.1:
version "1.53.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.53.1.tgz#0b6f7a2006ccb6126ffcc3e3b2fa9efda23b6638"
integrity sha512-Z46Oq7tLAyT0lGoFx4DOuB1IA9D1TPj0QkYxpPVUnGDqHHvDpCftu1J2hM2PiWsNMoZh8+LQaarAWcDfPBc6zg==

playwright@1.23.3:
version "1.23.3"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.23.3.tgz#67bf7e80de30a464e34b88aab02a694cbf2c59d0"
integrity sha512-4uPqXU1PBTBnNhqIyuz+WmvjlMNrt+Rje8lwBf3RpUP9UCjP8G41qrr/vDUbMoHhQaUfdWeDuZAkPUxAv5Ag8g==
playwright@1.53.1:
version "1.53.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.53.1.tgz#86fb041b237a6868d163c87c4b9737fd1cac145e"
integrity sha512-LJ13YLr/ocweuwxyGf1XNFWIU4M2zUSo149Qbp+A4cpwDjsxRPj7k6H25LBrEHiEwxvRbD8HdwvQmRMSvquhYw==
dependencies:
playwright-core "1.23.3"
playwright-core "1.53.1"
optionalDependencies:
fsevents "2.3.2"

postcss@^8.4.49:
version "8.4.49"
Expand Down