This commit updates the built in reporters to check for the documented case of a test's location being undefined. As a drive by fix, the C++ code for computing the test location now returns undefined if the script location is empty. This lets tests run inside of eval(). PR-URL: https://github.com/nodejs/node/pull/52036 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
10 lines
174 B
JavaScript
10 lines
174 B
JavaScript
// Flags: --test-reporter=tap
|
|
'use strict';
|
|
eval(`
|
|
const { test } = require('node:test');
|
|
|
|
test('passes');
|
|
test('fails', () => {
|
|
throw new Error('fail');
|
|
});
|
|
`);
|