mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test_runner: do not error when getting fullName of root context
PR-URL: https://github.com/nodejs/node/pull/59377 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
parent
589ef79bf8
commit
52f616d42f
|
|
@ -1533,6 +1533,8 @@ class Suite extends Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullName(test) {
|
function getFullName(test) {
|
||||||
|
if (test === test.root) return test.name;
|
||||||
|
|
||||||
let fullName = test.name;
|
let fullName = test.name;
|
||||||
|
|
||||||
for (let t = test.parent; t !== t.root; t = t.parent) {
|
for (let t = test.parent; t !== t.root; t = t.parent) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
const { strictEqual } = require('node:assert');
|
const { strictEqual } = require('node:assert');
|
||||||
const { suite, test } = require('node:test');
|
const { before, suite, test } = require('node:test');
|
||||||
|
|
||||||
|
before((t) => {
|
||||||
|
strictEqual(t.fullName, '<root>');
|
||||||
|
});
|
||||||
|
|
||||||
suite('suite', (t) => {
|
suite('suite', (t) => {
|
||||||
strictEqual(t.fullName, 'suite');
|
strictEqual(t.fullName, 'suite');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user