File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- require ( '../common' ) ;
2+ const common = require ( '../common' ) ;
33const assert = require ( 'node:assert' ) ;
4- const { spawnSync } = require ( 'node:child_process' ) ;
54const fixtures = require ( '../common/fixtures' ) ;
5+ const { run } = require ( 'node:test' ) ;
66
77const testFile = fixtures . path ( 'test-runner' , 'syntax-error-test.mjs' ) ;
8- const child = spawnSync ( process . execPath , [
9- '--no-warnings' ,
10- '--test' ,
11- '--test-reporter=tap' ,
12- '--test-isolation=none' ,
13- testFile ,
14- ] , { encoding : 'utf8' } ) ;
8+ const testRun = run ( {
9+ files : [ testFile ] ,
10+ isolation : 'none'
11+ } ) ;
1512
16- assert . match ( child . stdout , / e r r o r : .* " U n e x p e c t e d t o k e n ' t r u e ' " \n / ) ;
17- assert . match ( child . stdout , / S y n t a x E r r o r / ) ;
18- assert . strictEqual ( child . status , 1 ) ;
13+ testRun . on ( 'test:enqueue' , common . mustCall ( ( test ) => {
14+ assert . strictEqual ( test . file , testFile ) ;
15+ } ) ) ;
16+
17+ testRun . on ( 'test:fail' , common . mustCall ( ( test ) => {
18+ assert . match ( test . details . error . toString ( ) , / S y n t a x E r r o r : U n e x p e c t e d t o k e n ' t r u e ' / ) ;
19+ } ) ) ;
You can’t perform that action at this time.
0 commit comments