◐ Shell
clean mode source ↗

test: ensure assertions are reachable in more folders · nodejs/node@781a266

@@ -7,7 +7,7 @@ const { setTimeout } = require('node:timers/promises');

77

before((t) => t.diagnostic('before 1 called'));

88

after((t) => t.diagnostic('after 1 called'));

9910-

describe('describe hooks', () => {

10+

describe('describe hooks', common.mustCall(() => {

1111

const testArr = [];

1212

before(function() {

1313

testArr.push('before ' + this.name);

@@ -51,9 +51,9 @@ describe('describe hooks', () => {

5151

it('nested 1', () => testArr.push('nested 1'));

5252

test('nested 2', () => testArr.push('nested 2'));

5353

});

54-

});

54+

}));

555556-

describe('describe hooks - no subtests', () => {

56+

describe('describe hooks - no subtests', common.mustCall(() => {

5757

const testArr = [];

5858

before(function() {

5959

testArr.push('before ' + this.name);

@@ -67,18 +67,18 @@ describe('describe hooks - no subtests', () => {

6767

}));

6868

beforeEach(common.mustNotCall());

6969

afterEach(common.mustNotCall());

70-

});

70+

}));

71717272

describe('before throws', () => {

7373

before(() => { throw new Error('before'); });

7474

it('1', () => {});

7575

test('2', () => {});

7676

});

777778-

describe('before throws - no subtests', () => {

78+

describe('before throws - no subtests', common.mustCall(() => {

7979

before(() => { throw new Error('before'); });

8080

after(common.mustCall());

81-

});

81+

}));

82828383

describe('after throws', () => {

8484

after(() => { throw new Error('after'); });

@@ -102,11 +102,11 @@ describe('afterEach throws', () => {

102102

test('2', () => {});

103103

});

104104105-

describe('afterEach when test fails', () => {

105+

describe('afterEach when test fails', common.mustCall(() => {

106106

afterEach(common.mustCall(2));

107107

it('1', () => { throw new Error('test'); });

108108

test('2', () => {});

109-

});

109+

}));

110110111111

describe('afterEach throws and test fails', () => {

112112

afterEach(() => { throw new Error('afterEach'); });

@@ -246,13 +246,13 @@ test('t.after() is called if test body throws', (t) => {

246246

throw new Error('bye');

247247

});

248248249-

describe('run after when before throws', () => {

249+

describe('run after when before throws', common.mustCall(() => {

250250

after(common.mustCall(() => {

251251

console.log('- after() called');

252252

}));

253253

before(() => { throw new Error('before'); });

254254

it('1', () => {});

255-

});

255+

}));

256256257257258258

test('test hooks - async', async (t) => {