From 74d7c151468996943016eaf37b9e31756cb58b60 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov Date: Wed, 15 Jul 2026 14:10:10 +0000 Subject: [PATCH 1/3] test: fail if file does not exist --- tests/third_party_notices.test.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/third_party_notices.test.ts b/tests/third_party_notices.test.ts index c502a2cea..da20b2238 100644 --- a/tests/third_party_notices.test.ts +++ b/tests/third_party_notices.test.ts @@ -14,12 +14,15 @@ describe('THIRD_PARTY_NOTICES', () => { process.cwd(), 'build/src/third_party/THIRD_PARTY_NOTICES', ); - if (fs.existsSync(noticesPath)) { - const content = fs.readFileSync(noticesPath, 'utf-8'); - const normalizedContent = content - .replace(/^Version: .*$/gm, 'Version: ') - .replaceAll('\r', ''); - t.assert.snapshot(normalizedContent); + if (!fs.existsSync(noticesPath)) { + throw new Error( + 'THIRD_PARTY_NOTICES does not exist, run `npm ci && npm run bundle`', + ); } + const content = fs.readFileSync(noticesPath, 'utf-8'); + const normalizedContent = content + .replace(/^Version: .*$/gm, 'Version: ') + .replaceAll('\r', ''); + t.assert.snapshot(normalizedContent); }); }); From bce98317acee50aca078015795f1e5c0de815332 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov Date: Thu, 16 Jul 2026 13:43:01 +0000 Subject: [PATCH 2/3] fix --- .github/workflows/run-tests.yml | 7 +++++++ package.json | 2 ++ scripts/test.mjs | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 811da3676..6c9e1c478 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -71,6 +71,13 @@ jobs: ${{ matrix.os == 'windows-latest' && '--test-concurrency=1' || '' }} ${{ github.event_name == 'merge_group' && '--retry' || '' }} + - name: Run notices tests + shell: bash + run: > + npm run test:notices:no-build -- + ${{ matrix.os == 'windows-latest' && '--test-concurrency=1' || '' }} + ${{ github.event_name == 'merge_group' && '--retry' || '' }} + # Gating job for branch protection. test-success: name: '[Required] Tests passed' diff --git a/package.json b/package.json index d903ce4c5..ed9457649 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/bin/chrome-devtools-mcp.js", "test": "npm run build && node scripts/test.mjs", "test:no-build": "node scripts/test.mjs", + "test:notices": "npm run bundle && node scripts/test.mjs tests/third_party_notices.test.ts", + "test:notices:no-build": "node scripts/test.mjs tests/third_party_notices.test.ts", "test:only": "npm run build && node scripts/test.mjs --test-only", "test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots", "prepare": "node scripts/prepare.ts", diff --git a/scripts/test.mjs b/scripts/test.mjs index 0d427847f..8bd9230d7 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -51,7 +51,13 @@ if (userArgs.length > 0) { process.exit(0); } } else if (files.length === 0) { - files.push('build/tests/**/*.test.js'); + const {glob} = await import('node:fs/promises'); + for await (const tsFile of glob('tests/**/*.test.ts')) { + if (tsFile.replace(/\\/g, '/') === 'tests/third_party_notices.test.ts') { + continue; + } + files.push(path.join('build', tsFile.replace(/\.ts$/, '.js'))); + } } } From c30eb0d0ee6783022a5486354144607d0590b4ee Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov Date: Thu, 16 Jul 2026 15:19:26 +0000 Subject: [PATCH 3/3] fix --- .github/workflows/run-tests.yml | 4 +--- package.json | 4 ++-- scripts/test.mjs | 8 +------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6c9e1c478..13fc35d74 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -74,9 +74,7 @@ jobs: - name: Run notices tests shell: bash run: > - npm run test:notices:no-build -- - ${{ matrix.os == 'windows-latest' && '--test-concurrency=1' || '' }} - ${{ github.event_name == 'merge_group' && '--retry' || '' }} + npm run test:notices:no-build # Gating job for branch protection. test-success: diff --git a/package.json b/package.json index ed9457649..96e51a804 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "docs:generate": "node scripts/generate-docs.ts", "start": "npm run build && node build/src/bin/chrome-devtools-mcp.js", "start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/bin/chrome-devtools-mcp.js", - "test": "npm run build && node scripts/test.mjs", - "test:no-build": "node scripts/test.mjs", + "test": "npm run build && node scripts/test.mjs --test-skip-pattern=THIRD_PARTY_NOTICES", + "test:no-build": "node scripts/test.mjs --test-skip-pattern=THIRD_PARTY_NOTICES", "test:notices": "npm run bundle && node scripts/test.mjs tests/third_party_notices.test.ts", "test:notices:no-build": "node scripts/test.mjs tests/third_party_notices.test.ts", "test:only": "npm run build && node scripts/test.mjs --test-only", diff --git a/scripts/test.mjs b/scripts/test.mjs index 8bd9230d7..0d427847f 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -51,13 +51,7 @@ if (userArgs.length > 0) { process.exit(0); } } else if (files.length === 0) { - const {glob} = await import('node:fs/promises'); - for await (const tsFile of glob('tests/**/*.test.ts')) { - if (tsFile.replace(/\\/g, '/') === 'tests/third_party_notices.test.ts') { - continue; - } - files.push(path.join('build', tsFile.replace(/\.ts$/, '.js'))); - } + files.push('build/tests/**/*.test.js'); } }