Skip to content

Commit cf59fa0

Browse files
committed
test_runner: change tests to use describe/it
1 parent 6ce6729 commit cf59fa0

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed
Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
'use strict';
2-
const common = require('../common');
2+
require('../common');
33

44
// Return type of shorthands should be consistent
55
// with the return type of test
66

77
const assert = require('assert');
8-
const test = require('node:test');
8+
const { test, describe, it } = require('node:test');
99
const { isPromise } = require('util/types');
1010

11-
const testOnly = test({ only: true });
12-
const testTodo = test({ todo: true });
13-
const testSkip = test({ skip: true });
14-
const testOnlyShorthand = test.only();
15-
const testTodoShorthand = test.todo();
16-
const testSkipShorthand = test.skip();
11+
const testOnly = test('only test', { only: true });
12+
const testTodo = test('todo test', { todo: true });
13+
const testSkip = test('skip test', { skip: true });
14+
const testOnlyShorthand = test.only('only test shorthand');
15+
const testTodoShorthand = test.todo('todo test shorthand');
16+
const testSkipShorthand = test.skip('skip test shorthand');
1717

18-
// return Promise
19-
assert(isPromise(testOnly));
20-
assert(isPromise(testTodo));
21-
assert(isPromise(testSkip));
22-
assert(isPromise(testOnlyShorthand));
23-
assert(isPromise(testTodoShorthand));
24-
assert(isPromise(testSkipShorthand));
18+
describe('\'node:test\' and its shorthands should return the same', () => {
19+
it('should return a Promise', () => {
20+
assert(isPromise(testOnly));
21+
assert(isPromise(testTodo));
22+
assert(isPromise(testSkip));
23+
assert(isPromise(testOnlyShorthand));
24+
assert(isPromise(testTodoShorthand));
25+
assert(isPromise(testSkipShorthand));
26+
});
2527

26-
// resolve to undefined
27-
(async () => {
28-
assert.strictEqual(await testOnly, undefined);
29-
assert.strictEqual(await testTodo, undefined);
30-
assert.strictEqual(await testSkip, undefined);
31-
assert.strictEqual(await testOnlyShorthand, undefined);
32-
assert.strictEqual(await testTodoShorthand, undefined);
33-
assert.strictEqual(await testSkipShorthand, undefined);
34-
})().then(common.mustCall());
28+
it('should resolve undefined', async () => {
29+
assert.strictEqual(await testOnly, undefined);
30+
assert.strictEqual(await testTodo, undefined);
31+
assert.strictEqual(await testSkip, undefined);
32+
assert.strictEqual(await testOnlyShorthand, undefined);
33+
assert.strictEqual(await testTodoShorthand, undefined);
34+
assert.strictEqual(await testSkipShorthand, undefined);
35+
});
36+
});

0 commit comments

Comments
 (0)