Chrome DevTools for coding agents
test: fail if file does not exist (#2369)
Nikolay Vitkov71e5c59bc9a2
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.ymlindex 811da367..13fc35d7 100644--- a/.github/workflows/run-tests.yml+++ b/.github/workflows/run-tests.yml@@ -71,6 +71,11 @@ 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+# Gating job for branch protection.test-success:name: '[Required] Tests passed'diff --git a/package.json b/package.jsonindex d903ce4c..96e51a80 100644--- a/package.json+++ b/package.json@@ -20,8 +20,10 @@"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","test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots","prepare": "node scripts/prepare.ts",diff --git a/tests/third_party_notices.test.js.snapshot b/tests/third_party_notices.test.js.snapshotindex e37b22f1..4418c4d9 100644--- a/tests/third_party_notices.test.js.snapshot+++ b/tests/third_party_notices.test.js.snapshot@@ -1,4 +1,4 @@-exports[`THIRD_PARTY_NOTICES > matches snapshot if exists 1`] = `+exports[`THIRD_PARTY_NOTICES > matches snapshot 1`] = `Name: core-jsURL: https://core-js.ioVersion: <VERSION>diff --git a/tests/third_party_notices.test.ts b/tests/third_party_notices.test.tsindex c502a2ce..3778ddf4 100644--- a/tests/third_party_notices.test.ts+++ b/tests/third_party_notices.test.ts@@ -9,17 +9,20 @@ import path from 'node:path';import {describe, it} from 'node:test';describe('THIRD_PARTY_NOTICES', () => {- it('matches snapshot if exists', t => {+ it('matches snapshot', t => {const noticesPath = path.join(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: <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: <VERSION>')+ .replaceAll('\r', '');+ t.assert.snapshot(normalizedContent);});});