From 84c49dce6d2344c30da32400cbe8d0eee64c6472 Mon Sep 17 00:00:00 2001 From: shocker Date: Mon, 26 Jun 2023 21:07:55 -0400 Subject: [PATCH] test_runner: change tests to use `describe/it` --- test/parallel/test-runner-typechecking.js | 50 ++++++++++++----------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-runner-typechecking.js b/test/parallel/test-runner-typechecking.js index 03c75733a17509..e96761b1a054bd 100644 --- a/test/parallel/test-runner-typechecking.js +++ b/test/parallel/test-runner-typechecking.js @@ -1,34 +1,36 @@ 'use strict'; -const common = require('../common'); +require('../common'); // Return type of shorthands should be consistent // with the return type of test const assert = require('assert'); -const test = require('node:test'); +const { test, describe, it } = require('node:test'); const { isPromise } = require('util/types'); -const testOnly = test({ only: true }); -const testTodo = test({ todo: true }); -const testSkip = test({ skip: true }); -const testOnlyShorthand = test.only(); -const testTodoShorthand = test.todo(); -const testSkipShorthand = test.skip(); +const testOnly = test('only test', { only: true }); +const testTodo = test('todo test', { todo: true }); +const testSkip = test('skip test', { skip: true }); +const testOnlyShorthand = test.only('only test shorthand'); +const testTodoShorthand = test.todo('todo test shorthand'); +const testSkipShorthand = test.skip('skip test shorthand'); -// return Promise -assert(isPromise(testOnly)); -assert(isPromise(testTodo)); -assert(isPromise(testSkip)); -assert(isPromise(testOnlyShorthand)); -assert(isPromise(testTodoShorthand)); -assert(isPromise(testSkipShorthand)); +describe('\'node:test\' and its shorthands should return the same', () => { + it('should return a Promise', () => { + assert(isPromise(testOnly)); + assert(isPromise(testTodo)); + assert(isPromise(testSkip)); + assert(isPromise(testOnlyShorthand)); + assert(isPromise(testTodoShorthand)); + assert(isPromise(testSkipShorthand)); + }); -// resolve to undefined -(async () => { - assert.strictEqual(await testOnly, undefined); - assert.strictEqual(await testTodo, undefined); - assert.strictEqual(await testSkip, undefined); - assert.strictEqual(await testOnlyShorthand, undefined); - assert.strictEqual(await testTodoShorthand, undefined); - assert.strictEqual(await testSkipShorthand, undefined); -})().then(common.mustCall()); + it('should resolve undefined', async () => { + assert.strictEqual(await testOnly, undefined); + assert.strictEqual(await testTodo, undefined); + assert.strictEqual(await testSkip, undefined); + assert.strictEqual(await testOnlyShorthand, undefined); + assert.strictEqual(await testTodoShorthand, undefined); + assert.strictEqual(await testSkipShorthand, undefined); + }); +});