node/test/message/test_runner_no_refs.js
cjihrig 432d1b50e0 test: add initial test module
This commit adds a new 'test' module that exposes an API
for creating JavaScript tests. As the tests execute, TAP
output is written to standard output. This commit only supports
executing individual test files, and does not implement
command line functionality for a full test runner.

PR-URL: https://github.com/nodejs/node/pull/42325
Refs: https://github.com/nodejs/node/issues/40954
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-03-21 22:21:09 +00:00

14 lines
382 B
JavaScript

// Flags: --no-warnings
'use strict';
require('../common');
const test = require('node:test');
// When run alone, the test below does not keep the event loop alive.
test('does not keep event loop alive', async (t) => {
await t.test('+does not keep event loop alive', async (t) => {
return new Promise((resolve) => {
setTimeout(resolve, 1000).unref();
});
});
});