1- 'use strict' ;
2- const common = require ( '../common' ) ;
3- const startCLI = require ( '../common/debugger' ) ;
1+ import { skipIfInspectorDisabled , mustCall } from '../common/index.mjs' ;
42
5- common . skipIfInspectorDisabled ( ) ;
3+ skipIfInspectorDisabled ( ) ;
64
7- const assert = require ( 'assert' ) ;
8- const http = require ( 'http' ) ;
5+ import startCLI from '../common/debugger.js' ;
6+
7+ import assert from 'assert' ;
8+ import http from 'http' ;
99
1010const host = '127.0.0.1' ;
1111
@@ -14,14 +14,16 @@ const host = '127.0.0.1';
1414 res . statusCode = 400 ;
1515 res . end ( 'Bad Request' ) ;
1616 } ) ;
17- server . listen ( 0 , common . mustCall ( ( ) => {
17+
18+ server . listen ( 0 , mustCall ( async ( ) => {
1819 const port = server . address ( ) . port ;
1920 const cli = startCLI ( [ `${ host } :${ port } ` ] ) ;
20- cli . quit ( ) . then ( common . mustCall ( ( code ) => {
21+ try {
22+ const code = await cli . quit ( ) ;
2123 assert . strictEqual ( code , 1 ) ;
22- } ) ) . finally ( ( ) => {
24+ } finally {
2325 server . close ( ) ;
24- } ) ;
26+ }
2527 } ) ) ;
2628}
2729
@@ -30,13 +32,15 @@ const host = '127.0.0.1';
3032 res . statusCode = 200 ;
3133 res . end ( 'some data that is invalid json' ) ;
3234 } ) ;
33- server . listen ( 0 , host , common . mustCall ( ( ) => {
35+
36+ server . listen ( 0 , host , mustCall ( async ( ) => {
3437 const port = server . address ( ) . port ;
3538 const cli = startCLI ( [ `${ host } :${ port } ` ] ) ;
36- cli . quit ( ) . then ( common . mustCall ( ( code ) => {
39+ try {
40+ const code = await cli . quit ( ) ;
3741 assert . strictEqual ( code , 1 ) ;
38- } ) ) . finally ( ( ) => {
42+ } finally {
3943 server . close ( ) ;
40- } ) ;
44+ }
4145 } ) ) ;
4246}
0 commit comments