mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-11-04 15:00:11 +00:00
fix(cli): do not forward tool args to start (#3114)
Fixes #2985 ### Summary - Serialize auto-started daemon startup flags against `getCliOptions()` rather than `mcpOptions` in `src/bin/chrome-devtools.ts`, preventing tool arguments such as `emulate --viewport` from leaking into the daemon server startup flags. - Add end-to-end regression test in `tests/e2e/chrome-devtools-status.test.ts`.
This commit is contained in:
1 parent
058adcf6eb
commit
fef1598e09
2 files changed
+24
-2
No files matched your search
@@ -35,7 +35,7 @@ import {
|
||||
shieldLiteralArgs,
|
||||
} from '../config/cli-commands.js';
|
||||
import {commands} from '../config/cli-options.js';
|
||||
import {mcpOptions, getCliOptions} from '../config/mcp-options.js';
|
||||
import {getCliOptions} from '../config/mcp-options.js';
|
||||
|
||||
import {ConfigParser} from '../config/ConfigParser.js';
|
||||
|
||||
@@ -263,7 +263,7 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
|
||||
: Promise.resolve(undefined);
|
||||
|
||||
if (!daemonRunning) {
|
||||
await start(serializeArgs(mcpOptions, argv), sessionId);
|
||||
await start([], sessionId);
|
||||
}
|
||||
|
||||
const commandArgs: Record<string, unknown> = {};
|
||||
|
||||
@@ -38,4 +38,26 @@ describe('chrome-devtools', () => {
|
||||
|
||||
await assertDaemonIsRunning(sessionId);
|
||||
});
|
||||
|
||||
it('does not forward emulate viewport tool arg to daemon startup flags on auto-start', async () => {
|
||||
await assertDaemonIsNotRunning(sessionId);
|
||||
|
||||
const emulateResult = await runCli(
|
||||
['emulate', '1', '--viewport', '500x400x1'],
|
||||
sessionId,
|
||||
);
|
||||
assert.strictEqual(
|
||||
emulateResult.status,
|
||||
0,
|
||||
`emulate command failed: ${emulateResult.stderr}`,
|
||||
);
|
||||
|
||||
const statusResult = await runCli(['status'], sessionId);
|
||||
assert.strictEqual(
|
||||
statusResult.status,
|
||||
0,
|
||||
`status command failed: ${statusResult.stderr}`,
|
||||
);
|
||||
assert.match(statusResult.stdout, /args=\["--viaCli"\]/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user