22// parent process argv when spawning the watch child.
33import * as common from '../common/index.mjs' ;
44import assert from 'node:assert' ;
5- import { readFileSync , writeFileSync } from 'node:fs' ;
5+ import { writeFileSync } from 'node:fs' ;
66import { join } from 'node:path' ;
77import { run } from 'node:test' ;
88import tmpdir from '../common/tmpdir.js' ;
@@ -11,16 +11,13 @@ import { skipIfNoWatch } from '../common/watch.js';
1111skipIfNoWatch ( ) ;
1212tmpdir . refresh ( ) ;
1313
14- const marker = join ( tmpdir . path , 'marker' ) ;
1514writeFileSync ( join ( tmpdir . path , 'test.js' ) , `
1615const test = require('node:test');
17- const { writeFileSync } = require('node:fs');
1816
19- test('test ran from cwd', () => {
20- writeFileSync(${ JSON . stringify ( marker ) } , 'ran');
21- });
17+ test('test ran from cwd', () => {});
2218` ) ;
2319
20+ const passed = [ ] ;
2421const controller = new AbortController ( ) ;
2522const stream = run ( {
2623 cwd : tmpdir . path ,
@@ -36,8 +33,9 @@ const stream = run({
3633} ) ;
3734
3835stream . on ( 'test:fail' , common . mustNotCall ( ) ) ;
39- stream . on ( 'test:pass' , common . mustCall ( 1 ) ) ;
36+ stream . on ( 'test:pass' , common . mustCall ( ( data ) => passed . push ( data . name ) , 1 ) ) ;
4037// eslint-disable-next-line no-unused-vars
4138for await ( const _ of stream ) ;
4239
43- assert . strictEqual ( readFileSync ( marker , 'utf8' ) , 'ran' ) ;
40+ // Validate the expected test ran by name:
41+ assert . deepStrictEqual ( passed , [ 'test ran from cwd' ] ) ;
0 commit comments