Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: improve test
  • Loading branch information
geeksilva97 committed Jan 30, 2026
commit 1e6e3dd851a8144e62cb9b3d6627033c8f185b0a
25 changes: 13 additions & 12 deletions test/parallel/test-runner-enqueue-file-syntax-error.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('node:assert');
const { spawnSync } = require('node:child_process');
const fixtures = require('../common/fixtures');
const { run } = require('node:test');

const testFile = fixtures.path('test-runner', 'syntax-error-test.mjs');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the original issue states "test:enqueue event has no file field", should we cover it with a test?

const child = spawnSync(process.execPath, [
'--no-warnings',
'--test',
'--test-reporter=tap',
'--test-isolation=none',
testFile,
], { encoding: 'utf8' });
const testRun = run({
files: [testFile],
isolation: 'none'
});

assert.match(child.stdout, /error:.*"Unexpected token 'true'"\n/);
assert.match(child.stdout, /SyntaxError/);
assert.strictEqual(child.status, 1);
testRun.on('test:enqueue', common.mustCall((test) => {
assert.strictEqual(test.file, testFile);
}));

testRun.on('test:fail', common.mustCall((test) => {
assert.match(test.details.error.toString(), /SyntaxError: Unexpected token 'true'/);
}));
Loading