Skip to content

Commit 3a2b935

Browse files
committed
fix test
1 parent 742a56d commit 3a2b935

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
// Flags: --no-warnings
21
'use strict';
3-
const common = require('../common');
2+
require('../common');
43
const assert = require('node:assert');
5-
const { run } = require('node:test');
4+
const { spawnSync } = require('node:child_process');
65
const fixtures = require('../common/fixtures');
76

87
const 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, /SyntaxError/);
22-
}));
16+
assert.match(child.stdout, new RegExp(`# Subtest: ${testFile}`));
17+
assert.match(child.stdout, /location:.*syntax-error-test\.mjs/);
18+
assert.match(child.stdout, /SyntaxError/);
19+
assert.strictEqual(child.status, 1);

0 commit comments

Comments
 (0)