node/test/parallel/test-timers-nan-duration-warning-promises.js
Benjamin Gruenbaum 259163802c
test: validate promise-version setTimeout behavior with NaN
PR-URL: https://github.com/nodejs/node/pull/53622
Refs: https://github.com/nodejs/node/pull/46678
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-07-22 07:52:57 +02:00

12 lines
319 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { setTimeout } = require('timers/promises');
process.once('warning', common.mustCall((warning) => {
assert.strictEqual(warning.name, 'TimeoutNaNWarning');
}));
setTimeout(NaN).then(common.mustCall(), common.mustNotCall());