Skip to content

Commit cc9eb98

Browse files
committed
fix build
1 parent a1e7794 commit cc9eb98

9 files changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Run tests
6363
shell: bash
6464
if: ${{ matrix.node != '20' }}
65-
run: npm run test
65+
run: npm run test:no-build
6666

6767
# Gating job for branch protection.
6868
test-success:

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "index.js",
88
"scripts": {
99
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
10-
"bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs",
10+
"bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\"",
1111
"build": "tsc && node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/post-build.ts",
1212
"typecheck": "tsc --noEmit",
1313
"format": "eslint --cache --fix . && prettier --write --cache .",
@@ -16,11 +16,12 @@
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:node20": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test build/tests",
20-
"test": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --experimental-print-required-tla --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
21-
"test:only": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
22-
"test:only:no-build": "node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
23-
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
19+
"test:node20": "node --import ./build/tests/setup.js --test-reporter spec --test-force-exit --test build/tests",
20+
"test:no-build": "node --import ./build/tests/setup.js --no-warnings=ExperimentalWarning --experimental-print-required-tla --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
21+
"test": "npm run build && node --import ./build/tests/setup.js --no-warnings=ExperimentalWarning --experimental-print-required-tla --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
22+
"test:only": "npm run build && node --import ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
23+
"test:only:no-build": "node --import ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
24+
"test:update-snapshots": "npm run build && node --import ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
2425
"prepare": "node --experimental-strip-types scripts/prepare.ts",
2526
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts"
2627
},

scripts/post-build.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ function copyDevToolsDescriptionFiles() {
9696
const devtoolsIssuesDescriptionPath =
9797
'node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions';
9898
const sourceDir = path.join(process.cwd(), devtoolsIssuesDescriptionPath);
99-
const destDir = path.join(BUILD_DIR, devtoolsIssuesDescriptionPath);
99+
const destDir = path.join(
100+
BUILD_DIR,
101+
'src',
102+
'third_party',
103+
'issue-descriptions',
104+
);
100105
fs.cpSync(sourceDir, destDir, {recursive: true});
101106
}
102107

src/issue-descriptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as path from 'node:path';
99

1010
const DESCRIPTIONS_PATH = path.join(
1111
import.meta.dirname,
12-
'../node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions',
12+
'third_party/issue-descriptions',
1313
);
1414

1515
let issueDescriptions: Record<string, string> = {};

tests/DevtoolsUtils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import sinon from 'sinon';
1212
import {
1313
AggregatedIssue,
1414
DebuggerModel,
15-
} from '../node_modules/chrome-devtools-frontend/mcp/mcp.js';
15+
} from '../src/third_party/index.js';
1616
import {
1717
extractUrlLikeFromDevToolsTitle,
1818
urlsEqual,

tests/PageCollector.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {beforeEach, describe, it} from 'node:test';
1010
import type {Frame, HTTPRequest, Target, Protocol} from 'puppeteer-core';
1111
import sinon from 'sinon';
1212

13-
import {AggregatedIssue} from '../node_modules/chrome-devtools-frontend/mcp/mcp.js';
13+
import {AggregatedIssue} from '../src/third_party/index.js';
1414
import type {ListenerMap} from '../src/PageCollector.js';
1515
import {
1616
ConsoleCollector,

tests/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (!it.snapshot) {
2020
};
2121
}
2222

23-
// This is run by Node when we execute the tests via the --require flag.
23+
// This is run by Node when we execute the tests via the --import flag.
2424
it.snapshot.setResolveSnapshotPath(testPath => {
2525
// By default the snapshots go into the build directory, but we want them
2626
// in the tests/ directory.

tests/tools/console.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import assert from 'node:assert';
88
import {before, describe, it} from 'node:test';
99

10-
import {AggregatedIssue} from '../../node_modules/chrome-devtools-frontend/mcp/mcp.js';
10+
import {AggregatedIssue} from '../../src/third_party/index.js';
1111
import {loadIssueDescriptions} from '../../src/issue-descriptions.js';
1212
import {McpResponse} from '../../src/McpResponse.js';
1313
import {

tests/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
} from 'puppeteer-core';
1818
import sinon from 'sinon';
1919

20-
import {AggregatedIssue} from '../node_modules/chrome-devtools-frontend/mcp/mcp.js';
20+
import {AggregatedIssue} from '../src/third_party/index.js';
2121
import {McpContext} from '../src/McpContext.js';
2222
import {McpResponse} from '../src/McpResponse.js';
2323
import {stableIdSymbol} from '../src/PageCollector.js';

0 commit comments

Comments
 (0)