Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test on Node.js 20 #22651

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .github/workflows/tests_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
# Component tests require Node.js 16+ (they require ESM via TS)
node-version: 16
- run: npm i -g npm@8
- run: npm ci
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests_primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- os: ubuntu-22.04
node-version: 18
browser: chromium
- os: ubuntu-22.04
node-version: 20
browser: chromium
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -241,7 +244,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
# Component tests require Node.js 16+ (they require ESM via TS)
node-version: 16
- run: npm ci
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_secondary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ jobs:
matrix:
include:
- os: ubuntu-latest
node_version: "^18.0.0"
node_version: 18
- os: ubuntu-latest
node_version: "^16.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

note: 16 is already tested in tests_primary

node_version: 20
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions tests/config/testserver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class TestServer {
if (err) {
response.statusCode = 404;
response.setHeader('Content-Type', 'text/plain');
response.end(`File not found: ${filePath}`);
response.end(request.method !== 'HEAD' ? `File not found: ${filePath}` : null);
return;
}
const extension = filePath.substring(filePath.lastIndexOf('.') + 1);
Expand All @@ -269,9 +269,9 @@ export class TestServer {
const result = await gzipAsync(data);
// The HTTP transaction might be already terminated after async hop here.
if (!response.writableEnded)
response.end(result);
response.end(request.method !== 'HEAD' ? result : null);
} else {
response.end(data);
response.end(request.method !== 'HEAD' ? data : null);
}
}

Expand Down
5 changes: 4 additions & 1 deletion tests/library/browsercontext-storage-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,8 @@ it('should handle malformed file', async ({ contextFactory }, testInfo) => {
const error = await contextFactory({
storageState: file,
}).catch(e => e);
expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token o in JSON at position 1`);
if (+process.versions.node.split('.')[0] > 18)
expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token 'o', \"not-json\" is not valid JSON`);
else
expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token o in JSON at position 1`);
});