• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3
4// Return type of shorthands should be consistent
5// with the return type of test
6
7const assert = require('assert');
8const { test, describe, it } = require('node:test');
9const { isPromise } = require('util/types');
10
11const testOnly = test('only test', { only: true });
12const testTodo = test('todo test', { todo: true });
13const testSkip = test('skip test', { skip: true });
14const testOnlyShorthand = test.only('only test shorthand');
15const testTodoShorthand = test.todo('todo test shorthand');
16const testSkipShorthand = test.skip('skip test shorthand');
17
18describe('\'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  });
27
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});
37