mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
be8d64ec14
PR-URL: https://github.com/nodejs/node/pull/52108 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
28 lines
522 B
JavaScript
28 lines
522 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
function delay(time) {
|
|
return new Promise((resolve) => {
|
|
setTimeout(resolve, time);
|
|
});
|
|
}
|
|
|
|
async function test() {
|
|
for (let i = 0; i < 100000; i++) {
|
|
await new Promise((resolve, reject) => {
|
|
reject('value');
|
|
})
|
|
.then(() => { }, () => { });
|
|
}
|
|
|
|
const time0 = Date.now();
|
|
await delay(0);
|
|
|
|
const diff = Date.now() - time0;
|
|
assert.ok(Date.now() - time0 < 500, `Expected less than 500ms, got ${diff}ms`);
|
|
}
|
|
|
|
test();
|