Skip to content

Commit d179ecb

Browse files
committed
fix: support node20
1 parent 2275553 commit d179ecb

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- windows-latest
2121
- macos-latest
2222
node:
23+
- 20
2324
- 22
2425
- 24
2526
steps:
@@ -32,17 +33,26 @@ jobs:
3233
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3334
with:
3435
cache: npm
35-
node-version: ${{ matrix.node }}
36+
node-version: 22
3637

3738
- name: Install dependencies
3839
run: npm ci
3940

41+
- name: Build
42+
run: npm run build
43+
44+
- name: Set up Node.js
45+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
46+
with:
47+
cache: npm
48+
node-version: ${{ matrix.node }}
49+
4050
- name: Disable AppArmor
4151
if: ${{ matrix.os == 'ubuntu-latest' }}
4252
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
4353

4454
- name: Run tests
45-
run: npm run test
55+
run: npm run test:no-build
4656

4757
# Gating job for branch protection.
4858
test-success:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MCP clients.
2626

2727
## Requirements
2828

29-
- [Node.js 22](https://nodejs.org/) or newer.
29+
- [Node.js 20](https://nodejs.org/) or newer.
3030
- [Chrome](https://www.google.com/chrome/) current stable version or newer.
3131
- [npm](https://www.npmjs.com/).
3232

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"generate-docs": "npm run build && node --experimental-strip-types scripts/generate-docs.ts",
1616
"start": "npm run build && node build/src/index.js",
1717
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
18-
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test 'build/tests/**/*.test.js'",
18+
"test:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test 'build/tests/**/*.test.js'",
19+
"test": "npm run build && npm run test:no-build",
1920
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
2021
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
2122
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots 'build/tests/**/*.test.js'",

tests/setup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
*/
66
import {it} from 'node:test';
77

8+
if (!it.snapshot) {
9+
it.snapshot = {
10+
setResolveSnapshotPath: () => {},
11+
setDefaultSnapshotSerializers: () => {},
12+
};
13+
}
14+
815
// This is run by Node when we execute the tests via the --require flag.
916
it.snapshot.setResolveSnapshotPath(testPath => {
1017
// By default the snapshots go into the build directory, but we want them

tests/tools/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('performance', () => {
161161
context,
162162
);
163163

164-
t.assert.snapshot(response.responseLines.join('\n'));
164+
t.assert.snapshot?.(response.responseLines.join('\n'));
165165
});
166166
});
167167

tests/trace-processing/parse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ describe('Trace parsing', async () => {
2626
assert.ok(result?.insights);
2727

2828
const output = getTraceSummary(result);
29-
t.assert.snapshot(output);
29+
t.assert.snapshot?.(output);
3030
});
3131
});

0 commit comments

Comments
 (0)