File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change 1- // Flags: --no-warnings
21'use strict' ;
3- const common = require ( '../common' ) ;
2+ require ( '../common' ) ;
43const assert = require ( 'node:assert' ) ;
5- const { run } = require ( 'node:test ' ) ;
4+ const { spawnSync } = require ( 'node:child_process ' ) ;
65const fixtures = require ( '../common/fixtures' ) ;
76
87const testFile = fixtures . path ( 'test-runner' , 'syntax-error-test.mjs' ) ;
9- const stream = run ( {
10- files : [ testFile ] ,
11- isolation : 'none' ,
12- } ) ;
8+ const child = spawnSync ( process . execPath , [
9+ '--no-warnings' ,
10+ '--test' ,
11+ '--test-reporter=tap' ,
12+ '--test-isolation=none' ,
13+ testFile ,
14+ ] , { encoding : 'utf8' } ) ;
1315
14- stream . on ( 'test:enqueue' , common . mustCall ( ( data ) => {
15- assert . ok ( data . file , 'test:enqueue event should have file field' ) ;
16- assert . strictEqual ( data . file , testFile ) ;
17- } ) ) ;
18-
19- stream . on ( 'test:fail' , common . mustCall ( ( data ) => {
20- assert . ok ( data . details . error ) ;
21- assert . match ( data . details . error . message , / S y n t a x E r r o r / ) ;
22- } ) ) ;
16+ assert . match ( child . stdout , new RegExp ( `# Subtest: ${ testFile } ` ) ) ;
17+ assert . match ( child . stdout , / l o c a t i o n : .* s y n t a x - e r r o r - t e s t \. m j s / ) ;
18+ assert . match ( child . stdout , / S y n t a x E r r o r / ) ;
19+ assert . strictEqual ( child . status , 1 ) ;
You can’t perform that action at this time.
0 commit comments