Skip to content

Commit 91d83c4

Browse files
authored
test: fix shell for windows tests (#72)
1 parent c509c64 commit 91d83c4

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ jobs:
3535
node-version: ${{ matrix.node }}
3636

3737
- name: Install dependencies
38+
shell: bash
3839
run: npm ci
3940

4041
- name: Disable AppArmor
4142
if: ${{ matrix.os == 'ubuntu-latest' }}
43+
shell: bash
4244
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
4345

4446
- name: Run tests
47+
shell: bash
4548
run: npm run test
4649

4750
# Gating job for branch protection.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
1717
"start": "npm run build && node build/src/index.js",
1818
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
19-
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test 'build/tests/**/*.test.js'",
20-
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
21-
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
22-
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots 'build/tests/**/*.test.js'",
19+
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
20+
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
21+
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
22+
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
2323
"prepare": "node --experimental-strip-types scripts/prepare.ts"
2424
},
2525
"files": [

tests/setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
import {it} from 'node:test';
7+
import path from 'node:path';
78

89
// This is run by Node when we execute the tests via the --require flag.
910
it.snapshot.setResolveSnapshotPath(testPath => {
1011
// By default the snapshots go into the build directory, but we want them
1112
// in the tests/ directory.
12-
const correctPath = testPath?.replace('/build/tests', '/tests');
13+
const correctPath = testPath?.replace(path.join('build', 'tests'), 'tests');
1314
return correctPath + '.snapshot';
1415
});
1516

tests/tools/screenshot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('screenshot', () => {
6464
await withBrowser(async (response, context) => {
6565
const page = context.getSelectedPage();
6666
await page.setContent(
67-
`<div style="color:blue;">test</div>`.repeat(5_000),
67+
`<div style="color:blue;">test</div>`.repeat(7_000),
6868
);
6969
await screenshot.handler(
7070
{params: {format: 'png', fullPage: true}},

0 commit comments

Comments
 (0)