豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ jobs:
node-version: ${{ matrix.node }}

- name: Install dependencies
shell: bash
run: npm ci

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

- name: Run tests
shell: bash
run: npm run test

# Gating job for branch protection.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
"start": "npm run build && node build/src/index.js",
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test 'build/tests/**/*.test.js'",
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only 'build/tests/**/*.test.js'",
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots 'build/tests/**/*.test.js'",
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
"prepare": "node --experimental-strip-types scripts/prepare.ts"
},
"files": [
Expand Down
3 changes: 2 additions & 1 deletion tests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {it} from 'node:test';
import path from 'node:path';

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

Expand Down
2 changes: 1 addition & 1 deletion tests/tools/screenshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('screenshot', () => {
await withBrowser(async (response, context) => {
const page = context.getSelectedPage();
await page.setContent(
`<div style="color:blue;">test</div>`.repeat(5_000),
`<div style="color:blue;">test</div>`.repeat(7_000),
);
await screenshot.handler(
{params: {format: 'png', fullPage: true}},
Expand Down