@@ -22,6 +22,16 @@ describe('chrome-devtools', () => {
2222 ) ;
2323 }
2424
25+ function assertDaemonIsRunning ( ) {
26+ const result = spawnSync ( 'node' , [ CLI_PATH , 'status' ] ) ;
27+ assert . ok (
28+ result . stdout
29+ . toString ( )
30+ . startsWith ( 'chrome-devtools-mcp daemon is running.\n' ) ,
31+ 'chrome-devtools-mcp daemon is not running' ,
32+ ) ;
33+ }
34+
2535 beforeEach ( ( ) => {
2636 spawnSync ( 'node' , [ CLI_PATH , 'stop' ] ) ;
2737 assertDaemonIsNotRunning ( ) ;
@@ -42,11 +52,7 @@ describe('chrome-devtools', () => {
4252 `start command failed: ${ startResult . stderr . toString ( ) } ` ,
4353 ) ;
4454
45- const result = spawnSync ( 'node' , [ CLI_PATH , 'status' ] ) ;
46- assert . strictEqual (
47- result . stdout . toString ( ) ,
48- 'chrome-devtools-mcp daemon is running.\n' ,
49- ) ;
55+ assertDaemonIsRunning ( ) ;
5056 } ) ;
5157
5258 it ( 'can start and stop the daemon' , ( ) => {
@@ -101,11 +107,7 @@ describe('chrome-devtools', () => {
101107 ) ;
102108
103109 // Daemon should now be running.
104- const result = spawnSync ( 'node' , [ CLI_PATH , 'status' ] ) ;
105- assert . strictEqual (
106- result . stdout . toString ( ) ,
107- 'chrome-devtools-mcp daemon is running.\n' ,
108- ) ;
110+ assertDaemonIsNotRunning ( ) ;
109111 } ) ;
110112
111113 it ( 'forwards disclaimers to stderr on start' , ( ) => {
0 commit comments