@@ -14,14 +14,15 @@ import {
14
14
text ,
15
15
log ,
16
16
} from '@clack/prompts' ;
17
- import { exec } from 'child_process' ;
17
+ import { exec , spawn } from 'child_process' ;
18
18
import fs from 'node:fs' ;
19
19
import { setTimeout as sleep } from 'node:timers/promises' ;
20
20
import util from 'node:util' ;
21
21
import color from 'picocolors' ;
22
22
23
23
async function main ( ) {
24
24
const execAsync = util . promisify ( exec ) ;
25
+ const spawnAsync = util . promisify ( spawn ) ;
25
26
const cleanUpFiles = async ( ) => {
26
27
// Clean up the local ground truths.
27
28
const cleanUp = spinner ( ) ;
@@ -216,15 +217,21 @@ async function main() {
216
217
217
218
// User chose to open the Playwright report.
218
219
if ( shouldOpenReport ) {
219
- await execAsync ( 'npx playwright show-report' ) . catch ( ( ) => {
220
- console . error ( 'Error: Failed to open the Playwright report or user closed the report' ) ;
220
+ // Use spawn to display the server information and the key to quit the server.
221
+ spawn ( 'npx' , [ 'playwright' , 'show-report' ] , {
222
+ stdio : 'inherit' ,
221
223
} ) ;
222
224
} else {
223
225
// Inform the user that the Playwright report can be opened by running the following command.
224
- log . info ( 'You can open the Playwright report by running the following command: npx playwright show-report' ) ;
226
+ log . info ( 'If you change your mind, you can open the Playwright report by running the following command:' ) ;
227
+ log . info ( color . bold ( 'npx playwright show-report' ) ) ;
225
228
}
226
229
227
- outro ( "You're all set!" ) ;
230
+ if ( shouldOpenReport ) {
231
+ outro ( "You're all set! Don't forget to quit serving the Playwright report when you're done." ) ;
232
+ } else {
233
+ outro ( "You're all set!" ) ;
234
+ }
228
235
229
236
await sleep ( 1000 ) ;
230
237
}
0 commit comments