mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: move tick.js from test/async-hooks to test/common
PR-URL: https://github.com/nodejs/node/pull/23551 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
98d1d53b20
commit
2a1492a00d
@ -7,7 +7,7 @@ if (!common.isMainThread)
|
||||
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const crypto = require('crypto');
|
||||
|
@ -7,7 +7,7 @@ if (!common.isMainThread)
|
||||
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const crypto = require('crypto');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const async_hooks = require('async_hooks');
|
||||
const { AsyncResource } = async_hooks;
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -3,7 +3,7 @@ const common = require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const initHooks = require('./init-hooks');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const fs = require('fs');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const fs = require('fs');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const fs = require('fs');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const dns = require('dns');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const dns = require('dns');
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const spawn = require('child_process').spawn;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const dns = require('dns');
|
||||
|
@ -6,7 +6,7 @@ if (!common.hasIPv6)
|
||||
common.skip('IPv6 support required');
|
||||
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const net = require('net');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const TIMEOUT = common.platformTimeout(100);
|
||||
|
@ -8,7 +8,7 @@ const assert = require('assert');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const tls = require('tls');
|
||||
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -4,7 +4,7 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// general hook test setup
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -4,7 +4,7 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// general hook test setup
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tick = require('./tick');
|
||||
const tick = require('../common/tick');
|
||||
const initHooks = require('./init-hooks');
|
||||
const { checkInvocations } = require('./hook-checks');
|
||||
const dgram = require('dgram');
|
||||
|
@ -13,6 +13,7 @@ This directory contains modules used to test the Node.js implementation.
|
||||
* [Heap dump checker module](#heap-dump-checker-module)
|
||||
* [HTTP2 module](#http2-module)
|
||||
* [Internet module](#internet-module)
|
||||
* [tick module](#tick-module)
|
||||
* [tmpdir module](#tmpdir-module)
|
||||
* [WPT module](#wpt-module)
|
||||
|
||||
@ -744,6 +745,11 @@ a full `setImmediate()` invocation passes.
|
||||
should not be in scope when `listener.ongc()` is created.
|
||||
|
||||
|
||||
## tick Module
|
||||
|
||||
The `tick` module provides a helper function that can be used to call a callback
|
||||
after a given number of event loop "ticks".
|
||||
|
||||
## tmpdir Module
|
||||
|
||||
The `tmpdir` module supports the use of a temporary directory for testing.
|
||||
|
@ -6,6 +6,7 @@ if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
const http2 = require('http2');
|
||||
const makeDuplexPair = require('../common/duplexpair');
|
||||
const tick = require('../common/tick');
|
||||
|
||||
// This tests that running garbage collection while an Http2Session has
|
||||
// a write *scheduled*, it will survive that garbage collection.
|
||||
@ -25,8 +26,3 @@ const makeDuplexPair = require('../common/duplexpair');
|
||||
global.gc();
|
||||
});
|
||||
}
|
||||
|
||||
function tick(n, cb) {
|
||||
if (n--) setImmediate(tick, n, cb);
|
||||
else cb();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const util = require('util');
|
||||
const { MessageChannel } = require('worker_threads');
|
||||
const tick = require('../common/tick');
|
||||
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
|
||||
@ -42,10 +43,3 @@ port2.onmessage = common.mustCall((message) => {
|
||||
});
|
||||
});
|
||||
port1.postMessage(2);
|
||||
|
||||
function tick(n, cb) {
|
||||
if (n > 0)
|
||||
setImmediate(() => tick(n - 1, cb));
|
||||
else
|
||||
cb();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user