Skip to content

Commit 4a6cfd8

Browse files
dgozmanclaude
andcommitted
chore: test on Node 20-26, use a recent yarn berry, bump typescript
- Replace the Node 18 bots with Node 26. Playwright requires Node >=20, so every 18.x job was failing while installing `@playwright/test`. `engines.node` is bumped to >=20 accordingly. - Install yarn berry from npm instead of corepack. `yarn init`, which the generator runs, is a corepack "transparent command": in a project without a `packageManager` field corepack runs its own hardcoded default (4.14.1 today) and pins that into the generated project, no matter what `corepack prepare yarn@4 --activate` selected. Installing @yarnpkg/cli-dist directly makes the generated projects use the yarn we actually installed. - Skip the yarn-berry step on the Node 22 bots. On Node versions with a broken fstat for zip fds, the yarn PnP loader passes the CommonJS source to Node, which then loads Playwright through the ESM loader's CommonJS translator, where `require.cache` is undefined and loading test files fails with "TypeError: Cannot read properties of undefined". Node 22 is in that window for the current yarn. To be removed once the fix ships in @playwright/test. - Bump typescript to 6.0.3 and @types/node to 20.19.43. TypeScript 6 does not include @types/* automatically anymore, hence `types: ["node"]`. Dropping `include` puts the root playwright.config.ts into the project as well, so it is type checked instead of falling back to an inferred config in the editor. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019K5oVK8bNuHCvNVRauYieU
1 parent 380df0f commit 4a6cfd8

5 files changed

Lines changed: 42 additions & 34 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
node-version: [18.x, 20.x, 22.x, 24.x]
13+
node-version: [20.x, 22.x, 24.x, 26.x]
1414
os: [ubuntu-latest, windows-latest, macos-latest]
1515
steps:
1616
- uses: actions/checkout@v4
@@ -26,6 +26,10 @@ jobs:
2626
- run: npm run build
2727
- run: npx tsc --noEmit
2828
- run: npx playwright test --grep-invert yarn-berry
29-
- run: corepack enable
30-
- run: corepack prepare yarn@4 --activate
31-
- run: npx playwright test --grep yarn-berry
29+
# Note: `yarn init` through corepack pins a stale yarn version into the generated project,
30+
# so install yarn berry directly instead.
31+
# Yarn PnP is broken on Node 22: its loader passes the CommonJS source to Node, and require.cache is undefined.
32+
- if: matrix.node-version != '22.x'
33+
run: npm i -g --force @yarnpkg/cli-dist@4
34+
- if: matrix.node-version != '22.x'
35+
run: npx playwright test --grep yarn-berry

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
lib/
3-
test-results/
3+
test-results/
4+
.vscode

package-lock.json

Lines changed: 27 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"name": "Microsoft Corporation"
1212
},
1313
"engines": {
14-
"node": ">=18"
14+
"node": ">=20"
1515
},
1616
"main": "index.js",
1717
"bin": {
@@ -28,12 +28,12 @@
2828
"devDependencies": {
2929
"@playwright/test": "^1.59.0-alpha-1769819922000",
3030
"@types/ini": "^4.1.1",
31-
"@types/node": "^18.19.33",
31+
"@types/node": "^20.19.43",
3232
"ansi-colors": "^4.1.1",
3333
"commander": "^14.0.1",
3434
"enquirer": "^2.3.6",
3535
"esbuild": "^0.25.0",
3636
"ini": "^4.1.3",
37-
"typescript": "^5.4.5"
37+
"typescript": "^6.0.3"
3838
}
3939
}

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "ES2019",
4+
"types": ["node"],
45
"module": "commonjs",
56
"esModuleInterop": true,
67
"strict": true,
@@ -13,6 +14,5 @@
1314
"noUncheckedIndexedAccess": true
1415
},
1516
"compileOnSave": true,
16-
"include": ["src", "tests", "assets"],
17-
"exclude": ["assets/playwright-ct.config.ts", "assets/playwright-ct.config.js"]
17+
"exclude": ["node_modules", "lib", "test-results", "assets/playwright-ct.config.ts", "assets/playwright-ct.config.js"]
1818
}

0 commit comments

Comments
 (0)