| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | // parent process argv when spawning the watch child. | |
| 3 | 3 | import * as common from '../common/index.mjs'; | |
| 4 | 4 | import assert from 'node:assert'; | |
| 5 | - import { readFileSync, writeFileSync } from 'node:fs'; | ||
| 5 | + import { writeFileSync } from 'node:fs'; | ||
| 6 | 6 | import { join } from 'node:path'; | |
| 7 | 7 | import { run } from 'node:test'; | |
| 8 | 8 | import tmpdir from '../common/tmpdir.js'; | |
@@ -11,16 +11,13 @@ import { skipIfNoWatch } from '../common/watch.js'; | |||
| 11 | 11 | skipIfNoWatch(); | |
| 12 | 12 | tmpdir.refresh(); | |
| 13 | 13 | ||
| 14 | - const marker = join(tmpdir.path, 'marker'); | ||
| 15 | 14 | writeFileSync(join(tmpdir.path, 'test.js'), ` | |
| 16 | 15 | const test = require('node:test'); | |
| 17 | - const { writeFileSync } = require('node:fs'); | ||
| 18 | 16 | ||
| 19 | - test('test ran from cwd', () => { | ||
| 20 | - writeFileSync(${JSON.stringify(marker)}, 'ran'); | ||
| 21 | - }); | ||
| 17 | + test('test ran from cwd', () => {}); | ||
| 22 | 18 | `); | |
| 23 | 19 | ||
| 20 | + const passed = []; | ||
| 24 | 21 | const controller = new AbortController(); | |
| 25 | 22 | const stream = run({ | |
| 26 | 23 | cwd: tmpdir.path, | |
@@ -36,8 +33,9 @@ const stream = run({ | |||
| 36 | 33 | }); | |
| 37 | 34 | ||
| 38 | 35 | stream.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)); | ||
| 40 | 37 | // eslint-disable-next-line no-unused-vars | |
| 41 | 38 | for await (const _ of stream); | |
| 42 | 39 | ||
| 43 | - assert.strictEqual(readFileSync(marker, 'utf8'), 'ran'); | ||
| 40 | + // Validate the expected test ran by name: | ||
| 41 | + assert.deepStrictEqual(passed, ['test ran from cwd']); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments