◐ Shell
clean mode source ↗

test_runner: add passed, attempt, and diagnostic to SuiteContext · nodejs/node@dd43eff

@@ -9,6 +9,11 @@ before(common.mustCall((t) => {

991010

suite('suite', common.mustCall((t) => {

1111

assert.strictEqual(t.fullName, 'suite');

12+

// Test new SuiteContext properties

13+

assert.strictEqual(typeof t.passed, 'boolean');

14+

assert.strictEqual(t.attempt, 0);

15+

// diagnostic() can be called to add diagnostic output

16+

t.diagnostic('Suite diagnostic message');

12171318

test('test', (t) => {

1419

assert.strictEqual(t.fullName, 'suite > test');

@@ -26,3 +31,18 @@ suite('suite', common.mustCall((t) => {

2631

test((t) => {

2732

assert.strictEqual(t.fullName, '<anonymous>');

2833

});

34+35+

// Test SuiteContext passed, attempt, and diagnostic properties

36+

suite('suite with context checks', common.mustCall((ctx) => {

37+

assert.strictEqual(ctx.fullName, 'suite with context checks');

38+

assert.strictEqual(typeof ctx.passed, 'boolean');

39+

assert.strictEqual(ctx.attempt, 0);

40+

// Verify diagnostic method is callable

41+

ctx.diagnostic('Test diagnostic message in suite');

42+43+

test('child test', () => {

44+

// Verify properties are accessible in nested test

45+

assert.strictEqual(typeof ctx.passed, 'boolean');

46+

assert.strictEqual(ctx.attempt, 0);

47+

});

48+

}));