Skip to content

Commit 1175537

Browse files
committed
feat: integrate DevTools issue into the console
1 parent 2c1061b commit 1175537

File tree

6 files changed

+3
-51
lines changed

6 files changed

+3
-51
lines changed

src/PageCollector.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
} from '../node_modules/chrome-devtools-frontend/mcp/mcp.js';
1717

1818
import {FakeIssuesManager} from './DevtoolsUtils.js';
19-
import {features} from './features.js';
2019
import {logger} from './logger.js';
2120
import type {
2221
CDPSession,
@@ -228,9 +227,6 @@ export class ConsoleCollector extends PageCollector<
228227

229228
override addPage(page: Page): void {
230229
super.addPage(page);
231-
if (!features.issues) {
232-
return;
233-
}
234230
if (!this.#subscribedPages.has(page)) {
235231
const subscriber = new PageIssueSubscriber(page);
236232
this.#subscribedPages.set(page, subscriber);

src/features.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/main.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import './polyfill.js';
99
import type {Channel} from './browser.js';
1010
import {ensureBrowserConnected, ensureBrowserLaunched} from './browser.js';
1111
import {parseArguments} from './cli.js';
12-
import {features} from './features.js';
1312
import {loadIssueDescriptions} from './issue-descriptions.js';
1413
import {logger, saveLogsToFile} from './logger.js';
1514
import {McpContext} from './McpContext.js';
@@ -186,9 +185,7 @@ for (const tool of tools) {
186185
registerTool(tool);
187186
}
188187

189-
if (features.issues) {
190-
await loadIssueDescriptions();
191-
}
188+
await loadIssueDescriptions();
192189
const transport = new StdioServerTransport();
193190
await server.connect(transport);
194191
logger('Chrome DevTools MCP Server connected');

src/tools/console.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* Copyright 2025 Google LLC
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
7-
import {features} from '../features.js';
86
import {zod} from '../third_party/index.js';
97
import type {ConsoleMessageType} from '../third_party/index.js';
108

@@ -38,10 +36,6 @@ const FILTERABLE_MESSAGE_TYPES: [
3836
'issue',
3937
];
4038

41-
if (features.issues) {
42-
FILTERABLE_MESSAGE_TYPES.push('issue');
43-
}
44-
4539
export const listConsoleMessages = defineTool({
4640
name: 'list_console_messages',
4741
description:

tests/PageCollector.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
*/
66

77
import assert from 'node:assert';
8-
import {afterEach, beforeEach, describe, it} from 'node:test';
8+
import {beforeEach, describe, it} from 'node:test';
99

1010
import type {Frame, HTTPRequest, Target, Protocol} from 'puppeteer-core';
1111
import sinon from 'sinon';
1212

1313
import {AggregatedIssue} from '../node_modules/chrome-devtools-frontend/mcp/mcp.js';
14-
import {setIssuesEnabled} from '../src/features.js';
1514
import type {ListenerMap} from '../src/PageCollector.js';
1615
import {
1716
ConsoleCollector,
@@ -301,11 +300,6 @@ describe('ConsoleCollector', () => {
301300
},
302301
},
303302
};
304-
setIssuesEnabled(true);
305-
});
306-
307-
afterEach(() => {
308-
setIssuesEnabled(false);
309303
});
310304

311305
it('emits issues on page', async () => {

tests/tools/console.test.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*/
66

77
import assert from 'node:assert';
8-
import {afterEach, before, beforeEach, describe, it} from 'node:test';
8+
import {before, describe, it} from 'node:test';
99

1010
import {AggregatedIssue} from '../../node_modules/chrome-devtools-frontend/mcp/mcp.js';
11-
import {setIssuesEnabled} from '../../src/features.js';
1211
import {loadIssueDescriptions} from '../../src/issue-descriptions.js';
1312
import {McpResponse} from '../../src/McpResponse.js';
1413
import {
@@ -59,12 +58,6 @@ describe('console', () => {
5958
});
6059

6160
describe('issues', () => {
62-
beforeEach(() => {
63-
setIssuesEnabled(true);
64-
});
65-
afterEach(() => {
66-
setIssuesEnabled(false);
67-
});
6861
it('lists issues', async () => {
6962
await withMcpContext(async (response, context) => {
7063
const page = await context.newPage();
@@ -155,12 +148,6 @@ describe('console', () => {
155148

156149
describe('issues type', () => {
157150
const server = serverHooks();
158-
beforeEach(() => {
159-
setIssuesEnabled(true);
160-
});
161-
afterEach(() => {
162-
setIssuesEnabled(false);
163-
});
164151

165152
it('gets issue details with node id parsing', async t => {
166153
await withMcpContext(async (response, context) => {

0 commit comments

Comments
 (0)