cloudstructs 0.6.37 → 0.6.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/assets/slack-app/provider.lambda/index.js +12 -12
- package/assets/slack-textract/detect.lambda/index.js +24 -24
- package/assets/ssl-server-test/analyze.lambda/index.js +12 -12
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/dmarc/index.js +1 -1
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-app/manifest.js +1 -1
- package/lib/slack-app/slack-app.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/ssl-server-test/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/index.js +1 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -7
- package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -7
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -7
- package/node_modules/@types/is-stream/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@types/is-stream/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -7
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +5 -0
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +9 -1
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +5 -0
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +64 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +13 -1
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +22 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +1 -2
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +17 -4
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +6 -1
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -7
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +9 -0
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +554 -144
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +12 -2
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +11 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/crypto.d.ts +9 -1
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/events.d.ts +64 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs/promises.d.ts +15 -2
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http2.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/module.d.ts +17 -4
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/net.d.ts +6 -1
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream.d.ts +766 -728
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/test.d.ts +553 -143
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tls.d.ts +11 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/url.d.ts +14 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/util.d.ts +75 -11
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +14 -0
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +75 -11
- package/node_modules/keyv/README.md +2 -0
- package/node_modules/keyv/package.json +12 -13
- package/node_modules/keyv/src/index.d.ts +6 -10
- package/node_modules/keyv/src/index.js +1 -1
- package/package.json +23 -22
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
*/
|
|
81
81
|
declare module 'node:test' {
|
|
82
82
|
import { Readable } from 'node:stream';
|
|
83
|
+
import { AsyncResource } from 'node:async_hooks';
|
|
83
84
|
/**
|
|
84
85
|
* ```js
|
|
85
86
|
* import { tap } from 'node:test/reporters';
|
|
@@ -159,35 +160,35 @@ declare module 'node:test' {
|
|
|
159
160
|
* @param [name='The name'] The name of the suite, which is displayed when reporting test results.
|
|
160
161
|
* @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`.
|
|
161
162
|
* @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object.
|
|
162
|
-
* @return `undefined`.
|
|
163
|
+
* @return Immediately fulfilled with `undefined`.
|
|
163
164
|
*/
|
|
164
|
-
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
165
|
-
function describe(name?: string, fn?: SuiteFn): void
|
|
166
|
-
function describe(options?: TestOptions, fn?: SuiteFn): void
|
|
167
|
-
function describe(fn?: SuiteFn): void
|
|
165
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
166
|
+
function describe(name?: string, fn?: SuiteFn): Promise<void>;
|
|
167
|
+
function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
168
|
+
function describe(fn?: SuiteFn): Promise<void>;
|
|
168
169
|
namespace describe {
|
|
169
170
|
/**
|
|
170
171
|
* Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
|
|
171
172
|
*/
|
|
172
|
-
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
173
|
-
function skip(name?: string, fn?: SuiteFn): void
|
|
174
|
-
function skip(options?: TestOptions, fn?: SuiteFn): void
|
|
175
|
-
function skip(fn?: SuiteFn): void
|
|
173
|
+
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
174
|
+
function skip(name?: string, fn?: SuiteFn): Promise<void>;
|
|
175
|
+
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
176
|
+
function skip(fn?: SuiteFn): Promise<void>;
|
|
176
177
|
/**
|
|
177
178
|
* Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
|
|
178
179
|
*/
|
|
179
|
-
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
180
|
-
function todo(name?: string, fn?: SuiteFn): void
|
|
181
|
-
function todo(options?: TestOptions, fn?: SuiteFn): void
|
|
182
|
-
function todo(fn?: SuiteFn): void
|
|
180
|
+
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
181
|
+
function todo(name?: string, fn?: SuiteFn): Promise<void>;
|
|
182
|
+
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
183
|
+
function todo(fn?: SuiteFn): Promise<void>;
|
|
183
184
|
/**
|
|
184
185
|
* Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
|
|
185
186
|
* @since v18.15.0
|
|
186
187
|
*/
|
|
187
|
-
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
188
|
-
function only(name?: string, fn?: SuiteFn): void
|
|
189
|
-
function only(options?: TestOptions, fn?: SuiteFn): void
|
|
190
|
-
function only(fn?: SuiteFn): void
|
|
188
|
+
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
189
|
+
function only(name?: string, fn?: SuiteFn): Promise<void>;
|
|
190
|
+
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
191
|
+
function only(fn?: SuiteFn): Promise<void>;
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
193
194
|
* Shorthand for `test()`.
|
|
@@ -195,69 +196,79 @@ declare module 'node:test' {
|
|
|
195
196
|
* The `it()` function is imported from the `node:test` module.
|
|
196
197
|
* @since v18.6.0, v16.17.0
|
|
197
198
|
*/
|
|
198
|
-
function it(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
199
|
-
function it(name?: string, fn?: TestFn): void
|
|
200
|
-
function it(options?: TestOptions, fn?: TestFn): void
|
|
201
|
-
function it(fn?: TestFn): void
|
|
199
|
+
function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
200
|
+
function it(name?: string, fn?: TestFn): Promise<void>;
|
|
201
|
+
function it(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
202
|
+
function it(fn?: TestFn): Promise<void>;
|
|
202
203
|
namespace it {
|
|
203
204
|
/**
|
|
204
205
|
* Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
|
|
205
206
|
*/
|
|
206
|
-
function skip(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
207
|
-
function skip(name?: string, fn?: TestFn): void
|
|
208
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
209
|
-
function skip(fn?: TestFn): void
|
|
207
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
208
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
209
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
210
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
210
211
|
/**
|
|
211
212
|
* Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
|
|
212
213
|
*/
|
|
213
|
-
function todo(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
214
|
-
function todo(name?: string, fn?: TestFn): void
|
|
215
|
-
function todo(options?: TestOptions, fn?: TestFn): void
|
|
216
|
-
function todo(fn?: TestFn): void
|
|
214
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
215
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
216
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
217
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
217
218
|
/**
|
|
218
219
|
* Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
|
|
219
220
|
* @since v18.15.0
|
|
220
221
|
*/
|
|
221
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
222
|
-
function only(name?: string, fn?: TestFn): void
|
|
223
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
224
|
-
function only(fn?: TestFn): void
|
|
222
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
223
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
224
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
225
|
+
function only(fn?: TestFn): Promise<void>;
|
|
225
226
|
}
|
|
226
227
|
/**
|
|
227
228
|
* Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
|
|
228
229
|
* @since v20.2.0
|
|
229
230
|
*/
|
|
230
|
-
function skip(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
231
|
-
function skip(name?: string, fn?: TestFn): void
|
|
232
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
233
|
-
function skip(fn?: TestFn): void
|
|
231
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
232
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
233
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
234
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
234
235
|
/**
|
|
235
236
|
* Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
|
|
236
237
|
* @since v20.2.0
|
|
237
238
|
*/
|
|
238
|
-
function todo(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
239
|
-
function todo(name?: string, fn?: TestFn): void
|
|
240
|
-
function todo(options?: TestOptions, fn?: TestFn): void
|
|
241
|
-
function todo(fn?: TestFn): void
|
|
239
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
240
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
241
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
242
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
242
243
|
/**
|
|
243
244
|
* Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
|
|
244
245
|
* @since v20.2.0
|
|
245
246
|
*/
|
|
246
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
247
|
-
function only(name?: string, fn?: TestFn): void
|
|
248
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
249
|
-
function only(fn?: TestFn): void
|
|
247
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
248
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
249
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
250
|
+
function only(fn?: TestFn): Promise<void>;
|
|
250
251
|
/**
|
|
251
252
|
* The type of a function under test. The first argument to this function is a
|
|
252
253
|
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
253
254
|
* the second argument.
|
|
254
255
|
*/
|
|
255
|
-
type TestFn = (t: TestContext, done: (result?: any) => void) =>
|
|
256
|
+
type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
|
|
256
257
|
/**
|
|
257
258
|
* The type of a function under Suite.
|
|
258
259
|
* If the test uses callbacks, the callback function is passed as an argument
|
|
259
260
|
*/
|
|
260
|
-
type SuiteFn = (
|
|
261
|
+
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
|
|
262
|
+
interface TestShard {
|
|
263
|
+
/**
|
|
264
|
+
* A positive integer between 1 and `<total>` that specifies the index of the shard to run.
|
|
265
|
+
*/
|
|
266
|
+
index: number;
|
|
267
|
+
/**
|
|
268
|
+
* A positive integer that specifies the total number of shards to split the test files to.
|
|
269
|
+
*/
|
|
270
|
+
total: number;
|
|
271
|
+
}
|
|
261
272
|
interface RunOptions {
|
|
262
273
|
/**
|
|
263
274
|
* If a number is provided, then that many files would run in parallel.
|
|
@@ -295,6 +306,29 @@ declare module 'node:test' {
|
|
|
295
306
|
* For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
|
|
296
307
|
*/
|
|
297
308
|
testNamePatterns?: string | RegExp | string[] | RegExp[];
|
|
309
|
+
/**
|
|
310
|
+
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
|
|
311
|
+
*/
|
|
312
|
+
setup?: (root: unknown) => void | Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Whether to run in watch mode or not.
|
|
315
|
+
* @default false
|
|
316
|
+
*/
|
|
317
|
+
watch?: boolean | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Running tests in a specific shard.
|
|
320
|
+
* @default undefined
|
|
321
|
+
*/
|
|
322
|
+
shard?: TestShard | undefined;
|
|
323
|
+
}
|
|
324
|
+
class Test extends AsyncResource {
|
|
325
|
+
concurrency: number;
|
|
326
|
+
nesting: number;
|
|
327
|
+
only: boolean;
|
|
328
|
+
reporter: TestsStream;
|
|
329
|
+
runOnlySubtests: boolean;
|
|
330
|
+
testNumber: number;
|
|
331
|
+
timeout: number | null;
|
|
298
332
|
}
|
|
299
333
|
/**
|
|
300
334
|
* A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the
|
|
@@ -307,134 +341,50 @@ declare module 'node:test' {
|
|
|
307
341
|
addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
308
342
|
addListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
309
343
|
addListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
344
|
+
addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
345
|
+
addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
310
346
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
311
347
|
emit(event: 'test:diagnostic', data: DiagnosticData): boolean;
|
|
312
348
|
emit(event: 'test:fail', data: TestFail): boolean;
|
|
313
349
|
emit(event: 'test:pass', data: TestPass): boolean;
|
|
314
350
|
emit(event: 'test:plan', data: TestPlan): boolean;
|
|
315
351
|
emit(event: 'test:start', data: TestStart): boolean;
|
|
352
|
+
emit(event: 'test:stderr', data: TestStderr): boolean;
|
|
353
|
+
emit(event: 'test:stdout', data: TestStdout): boolean;
|
|
316
354
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
317
355
|
on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
318
356
|
on(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
319
357
|
on(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
320
358
|
on(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
321
359
|
on(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
360
|
+
on(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
361
|
+
on(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
322
362
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
323
363
|
once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
324
364
|
once(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
325
365
|
once(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
326
366
|
once(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
327
367
|
once(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
368
|
+
once(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
369
|
+
once(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
328
370
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
329
371
|
prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
330
372
|
prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
331
373
|
prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
332
374
|
prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
333
375
|
prependListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
376
|
+
prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
377
|
+
prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
334
378
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
335
379
|
prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
336
380
|
prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
337
381
|
prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
338
382
|
prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
339
383
|
prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
384
|
+
prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
385
|
+
prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
340
386
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
341
387
|
}
|
|
342
|
-
interface DiagnosticData {
|
|
343
|
-
/**
|
|
344
|
-
* The diagnostic message.
|
|
345
|
-
*/
|
|
346
|
-
message: string;
|
|
347
|
-
/**
|
|
348
|
-
* The nesting level of the test.
|
|
349
|
-
*/
|
|
350
|
-
nesting: number;
|
|
351
|
-
}
|
|
352
|
-
interface TestFail {
|
|
353
|
-
/**
|
|
354
|
-
* Additional execution metadata.
|
|
355
|
-
*/
|
|
356
|
-
details: {
|
|
357
|
-
/**
|
|
358
|
-
* The duration of the test in milliseconds.
|
|
359
|
-
*/
|
|
360
|
-
duration: number;
|
|
361
|
-
/**
|
|
362
|
-
* The error thrown by the test.
|
|
363
|
-
*/
|
|
364
|
-
error: Error;
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* The test name.
|
|
368
|
-
*/
|
|
369
|
-
name: string;
|
|
370
|
-
/**
|
|
371
|
-
* The nesting level of the test.
|
|
372
|
-
*/
|
|
373
|
-
nesting: number;
|
|
374
|
-
/**
|
|
375
|
-
* The ordinal number of the test.
|
|
376
|
-
*/
|
|
377
|
-
testNumber: number;
|
|
378
|
-
/**
|
|
379
|
-
* Present if `context.todo` is called.
|
|
380
|
-
*/
|
|
381
|
-
todo?: string | boolean;
|
|
382
|
-
/**
|
|
383
|
-
* Present if `context.skip` is called.
|
|
384
|
-
*/
|
|
385
|
-
skip?: string | boolean;
|
|
386
|
-
}
|
|
387
|
-
interface TestPass {
|
|
388
|
-
/**
|
|
389
|
-
* Additional execution metadata.
|
|
390
|
-
*/
|
|
391
|
-
details: {
|
|
392
|
-
/**
|
|
393
|
-
* The duration of the test in milliseconds.
|
|
394
|
-
*/
|
|
395
|
-
duration: number;
|
|
396
|
-
};
|
|
397
|
-
/**
|
|
398
|
-
* The test name.
|
|
399
|
-
*/
|
|
400
|
-
name: string;
|
|
401
|
-
/**
|
|
402
|
-
* The nesting level of the test.
|
|
403
|
-
*/
|
|
404
|
-
nesting: number;
|
|
405
|
-
/**
|
|
406
|
-
* The ordinal number of the test.
|
|
407
|
-
*/
|
|
408
|
-
testNumber: number;
|
|
409
|
-
/**
|
|
410
|
-
* Present if `context.todo` is called.
|
|
411
|
-
*/
|
|
412
|
-
todo?: string | boolean;
|
|
413
|
-
/**
|
|
414
|
-
* Present if `context.skip` is called.
|
|
415
|
-
*/
|
|
416
|
-
skip?: string | boolean;
|
|
417
|
-
}
|
|
418
|
-
interface TestPlan {
|
|
419
|
-
/**
|
|
420
|
-
* The nesting level of the test.
|
|
421
|
-
*/
|
|
422
|
-
nesting: number;
|
|
423
|
-
/**
|
|
424
|
-
* The number of subtests that have ran.
|
|
425
|
-
*/
|
|
426
|
-
count: number;
|
|
427
|
-
}
|
|
428
|
-
interface TestStart {
|
|
429
|
-
/**
|
|
430
|
-
* The test name.
|
|
431
|
-
*/
|
|
432
|
-
name: string;
|
|
433
|
-
/**
|
|
434
|
-
* The nesting level of the test.
|
|
435
|
-
*/
|
|
436
|
-
nesting: number;
|
|
437
|
-
}
|
|
438
388
|
/**
|
|
439
389
|
* An instance of `TestContext` is passed to each test function in order to
|
|
440
390
|
* interact with the test runner. However, the `TestContext` constructor is not
|
|
@@ -570,6 +520,24 @@ declare module 'node:test' {
|
|
|
570
520
|
*/
|
|
571
521
|
readonly mock: MockTracker;
|
|
572
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* An instance of `SuiteContext` is passed to each suite function in order to
|
|
525
|
+
* interact with the test runner. However, the `SuiteContext` constructor is not
|
|
526
|
+
* exposed as part of the API.
|
|
527
|
+
* @since v18.7.0, v16.17.0
|
|
528
|
+
*/
|
|
529
|
+
class SuiteContext {
|
|
530
|
+
/**
|
|
531
|
+
* The name of the suite.
|
|
532
|
+
* @since v18.8.0, v16.18.0
|
|
533
|
+
*/
|
|
534
|
+
readonly name: string;
|
|
535
|
+
/**
|
|
536
|
+
* Can be used to abort test subtasks when the test has been aborted.
|
|
537
|
+
* @since v18.7.0, v16.17.0
|
|
538
|
+
*/
|
|
539
|
+
readonly signal: AbortSignal;
|
|
540
|
+
}
|
|
573
541
|
interface TestOptions {
|
|
574
542
|
/**
|
|
575
543
|
* If a number is provided, then that many tests would run in parallel.
|
|
@@ -905,6 +873,7 @@ declare module 'node:test' {
|
|
|
905
873
|
* @since v19.1.0, v18.13.0
|
|
906
874
|
*/
|
|
907
875
|
restoreAll(): void;
|
|
876
|
+
timers: MockTimers;
|
|
908
877
|
}
|
|
909
878
|
const mock: MockTracker;
|
|
910
879
|
interface MockFunctionCall<
|
|
@@ -1048,5 +1017,446 @@ declare module 'node:test' {
|
|
|
1048
1017
|
*/
|
|
1049
1018
|
restore(): void;
|
|
1050
1019
|
}
|
|
1020
|
+
type Timer = 'setInterval' | 'clearInterval' | 'setTimeout' | 'clearTimeout';
|
|
1021
|
+
/**
|
|
1022
|
+
* Mocking timers is a technique commonly used in software testing to simulate and
|
|
1023
|
+
* control the behavior of timers, such as `setInterval` and `setTimeout`,
|
|
1024
|
+
* without actually waiting for the specified time intervals.
|
|
1025
|
+
*
|
|
1026
|
+
* The `MockTracker` provides a top-level `timers` export
|
|
1027
|
+
* which is a `MockTimers` instance.
|
|
1028
|
+
* @since v20.4.0
|
|
1029
|
+
* @experimental
|
|
1030
|
+
*/
|
|
1031
|
+
class MockTimers {
|
|
1032
|
+
/**
|
|
1033
|
+
* Enables timer mocking for the specified timers.
|
|
1034
|
+
*
|
|
1035
|
+
* **Note:** When you enable mocking for a specific timer, its associated
|
|
1036
|
+
* clear function will also be implicitly mocked.
|
|
1037
|
+
*
|
|
1038
|
+
* Example usage:
|
|
1039
|
+
*
|
|
1040
|
+
* ```js
|
|
1041
|
+
* import { mock } from 'node:test';
|
|
1042
|
+
* mock.timers.enable(['setInterval']);
|
|
1043
|
+
* ```
|
|
1044
|
+
*
|
|
1045
|
+
* ```js
|
|
1046
|
+
* const { mock } = require('node:test');
|
|
1047
|
+
* mock.timers.enable(['setInterval']);
|
|
1048
|
+
* ```
|
|
1049
|
+
*
|
|
1050
|
+
* The above example enables mocking for the `setInterval` timer and
|
|
1051
|
+
* implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked.
|
|
1052
|
+
*
|
|
1053
|
+
* Alternatively, if you call `mock.timers.enable()` without any parameters:
|
|
1054
|
+
*
|
|
1055
|
+
* All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`)
|
|
1056
|
+
* will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`,
|
|
1057
|
+
* and `globalThis` will be mocked.
|
|
1058
|
+
* @since v20.4.0
|
|
1059
|
+
*/
|
|
1060
|
+
enable(timers?: Timer[]): void;
|
|
1061
|
+
/**
|
|
1062
|
+
* This function restores the default behavior of all mocks that were previously
|
|
1063
|
+
* created by this `MockTimers` instance and disassociates the mocks
|
|
1064
|
+
* from the `MockTracker` instance.
|
|
1065
|
+
*
|
|
1066
|
+
* **Note:** After each test completes, this function is called on
|
|
1067
|
+
* the test context's `MockTracker`.
|
|
1068
|
+
*
|
|
1069
|
+
* ```js
|
|
1070
|
+
* import { mock } from 'node:test';
|
|
1071
|
+
* mock.timers.reset();
|
|
1072
|
+
* ```
|
|
1073
|
+
*
|
|
1074
|
+
* ```js
|
|
1075
|
+
* const { mock } = require('node:test');
|
|
1076
|
+
* mock.timers.reset();
|
|
1077
|
+
* ```
|
|
1078
|
+
* @since v20.4.0
|
|
1079
|
+
*/
|
|
1080
|
+
reset(): void;
|
|
1081
|
+
/**
|
|
1082
|
+
* Advances time for all mocked timers.
|
|
1083
|
+
*
|
|
1084
|
+
* **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts
|
|
1085
|
+
* only positive numbers. In Node.js, `setTimeout` with negative numbers is
|
|
1086
|
+
* only supported for web compatibility reasons.
|
|
1087
|
+
*
|
|
1088
|
+
* The following example mocks a `setTimeout` function and
|
|
1089
|
+
* by using `.tick` advances in
|
|
1090
|
+
* time triggering all pending timers.
|
|
1091
|
+
*
|
|
1092
|
+
* ```js
|
|
1093
|
+
* import assert from 'node:assert';
|
|
1094
|
+
* import { test } from 'node:test';
|
|
1095
|
+
*
|
|
1096
|
+
* test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
|
|
1097
|
+
* const fn = context.mock.fn();
|
|
1098
|
+
*
|
|
1099
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1100
|
+
*
|
|
1101
|
+
* setTimeout(fn, 9999);
|
|
1102
|
+
*
|
|
1103
|
+
* assert.strictEqual(fn.mock.callCount(), 0);
|
|
1104
|
+
*
|
|
1105
|
+
* // Advance in time
|
|
1106
|
+
* context.mock.timers.tick(9999);
|
|
1107
|
+
*
|
|
1108
|
+
* assert.strictEqual(fn.mock.callCount(), 1);
|
|
1109
|
+
* });
|
|
1110
|
+
* ```
|
|
1111
|
+
*
|
|
1112
|
+
* ```js
|
|
1113
|
+
* const assert = require('node:assert');
|
|
1114
|
+
* const { test } = require('node:test');
|
|
1115
|
+
*
|
|
1116
|
+
* test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
|
|
1117
|
+
* const fn = context.mock.fn();
|
|
1118
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1119
|
+
*
|
|
1120
|
+
* setTimeout(fn, 9999);
|
|
1121
|
+
* assert.strictEqual(fn.mock.callCount(), 0);
|
|
1122
|
+
*
|
|
1123
|
+
* // Advance in time
|
|
1124
|
+
* context.mock.timers.tick(9999);
|
|
1125
|
+
*
|
|
1126
|
+
* assert.strictEqual(fn.mock.callCount(), 1);
|
|
1127
|
+
* });
|
|
1128
|
+
* ```
|
|
1129
|
+
*
|
|
1130
|
+
* Alternativelly, the `.tick` function can be called many times
|
|
1131
|
+
*
|
|
1132
|
+
* ```js
|
|
1133
|
+
* import assert from 'node:assert';
|
|
1134
|
+
* import { test } from 'node:test';
|
|
1135
|
+
*
|
|
1136
|
+
* test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
|
|
1137
|
+
* const fn = context.mock.fn();
|
|
1138
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1139
|
+
* const nineSecs = 9000;
|
|
1140
|
+
* setTimeout(fn, nineSecs);
|
|
1141
|
+
*
|
|
1142
|
+
* const twoSeconds = 3000;
|
|
1143
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1144
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1145
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1146
|
+
*
|
|
1147
|
+
* assert.strictEqual(fn.mock.callCount(), 1);
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*
|
|
1151
|
+
* ```js
|
|
1152
|
+
* const assert = require('node:assert');
|
|
1153
|
+
* const { test } = require('node:test');
|
|
1154
|
+
*
|
|
1155
|
+
* test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
|
|
1156
|
+
* const fn = context.mock.fn();
|
|
1157
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1158
|
+
* const nineSecs = 9000;
|
|
1159
|
+
* setTimeout(fn, nineSecs);
|
|
1160
|
+
*
|
|
1161
|
+
* const twoSeconds = 3000;
|
|
1162
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1163
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1164
|
+
* context.mock.timers.tick(twoSeconds);
|
|
1165
|
+
*
|
|
1166
|
+
* assert.strictEqual(fn.mock.callCount(), 1);
|
|
1167
|
+
* });
|
|
1168
|
+
* ```
|
|
1169
|
+
* @since v20.4.0
|
|
1170
|
+
*/
|
|
1171
|
+
tick(milliseconds: number): void;
|
|
1172
|
+
/**
|
|
1173
|
+
* Triggers all pending mocked timers immediately.
|
|
1174
|
+
*
|
|
1175
|
+
* The example below triggers all pending timers immediately,
|
|
1176
|
+
* causing them to execute without any delay.
|
|
1177
|
+
*
|
|
1178
|
+
* ```js
|
|
1179
|
+
* import assert from 'node:assert';
|
|
1180
|
+
* import { test } from 'node:test';
|
|
1181
|
+
*
|
|
1182
|
+
* test('runAll functions following the given order', (context) => {
|
|
1183
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1184
|
+
* const results = [];
|
|
1185
|
+
* setTimeout(() => results.push(1), 9999);
|
|
1186
|
+
*
|
|
1187
|
+
* // Notice that if both timers have the same timeout,
|
|
1188
|
+
* // the order of execution is guaranteed
|
|
1189
|
+
* setTimeout(() => results.push(3), 8888);
|
|
1190
|
+
* setTimeout(() => results.push(2), 8888);
|
|
1191
|
+
*
|
|
1192
|
+
* assert.deepStrictEqual(results, []);
|
|
1193
|
+
*
|
|
1194
|
+
* context.mock.timers.runAll();
|
|
1195
|
+
*
|
|
1196
|
+
* assert.deepStrictEqual(results, [3, 2, 1]);
|
|
1197
|
+
* });
|
|
1198
|
+
* ```
|
|
1199
|
+
*
|
|
1200
|
+
* ```js
|
|
1201
|
+
* const assert = require('node:assert');
|
|
1202
|
+
* const { test } = require('node:test');
|
|
1203
|
+
*
|
|
1204
|
+
* test('runAll functions following the given order', (context) => {
|
|
1205
|
+
* context.mock.timers.enable(['setTimeout']);
|
|
1206
|
+
* const results = [];
|
|
1207
|
+
* setTimeout(() => results.push(1), 9999);
|
|
1208
|
+
*
|
|
1209
|
+
* // Notice that if both timers have the same timeout,
|
|
1210
|
+
* // the order of execution is guaranteed
|
|
1211
|
+
* setTimeout(() => results.push(3), 8888);
|
|
1212
|
+
* setTimeout(() => results.push(2), 8888);
|
|
1213
|
+
*
|
|
1214
|
+
* assert.deepStrictEqual(results, []);
|
|
1215
|
+
*
|
|
1216
|
+
* context.mock.timers.runAll();
|
|
1217
|
+
*
|
|
1218
|
+
* assert.deepStrictEqual(results, [3, 2, 1]);
|
|
1219
|
+
* });
|
|
1220
|
+
* ```
|
|
1221
|
+
*
|
|
1222
|
+
* **Note:** The `runAll()` function is specifically designed for
|
|
1223
|
+
* triggering timers in the context of timer mocking.
|
|
1224
|
+
* It does not have any effect on real-time system
|
|
1225
|
+
* clocks or actual timers outside of the mocking environment.
|
|
1226
|
+
* @since v20.4.0
|
|
1227
|
+
*/
|
|
1228
|
+
runAll(): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* Calls {@link MockTimers.reset()}.
|
|
1231
|
+
*/
|
|
1232
|
+
[Symbol.dispose](): void;
|
|
1233
|
+
}
|
|
1051
1234
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };
|
|
1052
1235
|
}
|
|
1236
|
+
|
|
1237
|
+
interface DiagnosticData {
|
|
1238
|
+
/**
|
|
1239
|
+
* The diagnostic message.
|
|
1240
|
+
*/
|
|
1241
|
+
message: string;
|
|
1242
|
+
/**
|
|
1243
|
+
* The nesting level of the test.
|
|
1244
|
+
*/
|
|
1245
|
+
nesting: number;
|
|
1246
|
+
/**
|
|
1247
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1248
|
+
*/
|
|
1249
|
+
file?: string;
|
|
1250
|
+
}
|
|
1251
|
+
interface TestFail {
|
|
1252
|
+
/**
|
|
1253
|
+
* Additional execution metadata.
|
|
1254
|
+
*/
|
|
1255
|
+
details: {
|
|
1256
|
+
/**
|
|
1257
|
+
* The duration of the test in milliseconds.
|
|
1258
|
+
*/
|
|
1259
|
+
duration_ms: number;
|
|
1260
|
+
/**
|
|
1261
|
+
* The error thrown by the test.
|
|
1262
|
+
*/
|
|
1263
|
+
error: Error;
|
|
1264
|
+
/**
|
|
1265
|
+
* The type of the test, used to denote whether this is a suite.
|
|
1266
|
+
* @since 20.0.0, 19.9.0, 18.17.0
|
|
1267
|
+
*/
|
|
1268
|
+
type?: 'suite';
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* The test name.
|
|
1272
|
+
*/
|
|
1273
|
+
name: string;
|
|
1274
|
+
/**
|
|
1275
|
+
* The nesting level of the test.
|
|
1276
|
+
*/
|
|
1277
|
+
nesting: number;
|
|
1278
|
+
/**
|
|
1279
|
+
* The ordinal number of the test.
|
|
1280
|
+
*/
|
|
1281
|
+
testNumber: number;
|
|
1282
|
+
/**
|
|
1283
|
+
* Present if `context.todo` is called.
|
|
1284
|
+
*/
|
|
1285
|
+
todo?: string | boolean;
|
|
1286
|
+
/**
|
|
1287
|
+
* Present if `context.skip` is called.
|
|
1288
|
+
*/
|
|
1289
|
+
skip?: string | boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1292
|
+
*/
|
|
1293
|
+
file?: string;
|
|
1294
|
+
}
|
|
1295
|
+
interface TestPass {
|
|
1296
|
+
/**
|
|
1297
|
+
* Additional execution metadata.
|
|
1298
|
+
*/
|
|
1299
|
+
details: {
|
|
1300
|
+
/**
|
|
1301
|
+
* The duration of the test in milliseconds.
|
|
1302
|
+
*/
|
|
1303
|
+
duration_ms: number;
|
|
1304
|
+
/**
|
|
1305
|
+
* The type of the test, used to denote whether this is a suite.
|
|
1306
|
+
* @since 20.0.0, 19.9.0, 18.17.0
|
|
1307
|
+
*/
|
|
1308
|
+
type?: 'suite';
|
|
1309
|
+
};
|
|
1310
|
+
/**
|
|
1311
|
+
* The test name.
|
|
1312
|
+
*/
|
|
1313
|
+
name: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* The nesting level of the test.
|
|
1316
|
+
*/
|
|
1317
|
+
nesting: number;
|
|
1318
|
+
/**
|
|
1319
|
+
* The ordinal number of the test.
|
|
1320
|
+
*/
|
|
1321
|
+
testNumber: number;
|
|
1322
|
+
/**
|
|
1323
|
+
* Present if `context.todo` is called.
|
|
1324
|
+
*/
|
|
1325
|
+
todo?: string | boolean;
|
|
1326
|
+
/**
|
|
1327
|
+
* Present if `context.skip` is called.
|
|
1328
|
+
*/
|
|
1329
|
+
skip?: string | boolean;
|
|
1330
|
+
/**
|
|
1331
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1332
|
+
*/
|
|
1333
|
+
file?: string;
|
|
1334
|
+
}
|
|
1335
|
+
interface TestPlan {
|
|
1336
|
+
/**
|
|
1337
|
+
* The nesting level of the test.
|
|
1338
|
+
*/
|
|
1339
|
+
nesting: number;
|
|
1340
|
+
/**
|
|
1341
|
+
* The number of subtests that have ran.
|
|
1342
|
+
*/
|
|
1343
|
+
count: number;
|
|
1344
|
+
/**
|
|
1345
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1346
|
+
*/
|
|
1347
|
+
file?: string;
|
|
1348
|
+
}
|
|
1349
|
+
interface TestStart {
|
|
1350
|
+
/**
|
|
1351
|
+
* The test name.
|
|
1352
|
+
*/
|
|
1353
|
+
name: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* The nesting level of the test.
|
|
1356
|
+
*/
|
|
1357
|
+
nesting: number;
|
|
1358
|
+
/**
|
|
1359
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1360
|
+
*/
|
|
1361
|
+
file?: string;
|
|
1362
|
+
}
|
|
1363
|
+
interface TestStderr {
|
|
1364
|
+
/**
|
|
1365
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1366
|
+
*/
|
|
1367
|
+
file?: string;
|
|
1368
|
+
/**
|
|
1369
|
+
* The message written to `stderr`
|
|
1370
|
+
*/
|
|
1371
|
+
message: string;
|
|
1372
|
+
}
|
|
1373
|
+
interface TestStdout {
|
|
1374
|
+
/**
|
|
1375
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1376
|
+
*/
|
|
1377
|
+
file?: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* The message written to `stdout`
|
|
1380
|
+
*/
|
|
1381
|
+
message: string;
|
|
1382
|
+
}
|
|
1383
|
+
interface TestEnqueue {
|
|
1384
|
+
/**
|
|
1385
|
+
* The test name
|
|
1386
|
+
*/
|
|
1387
|
+
name: string;
|
|
1388
|
+
/**
|
|
1389
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1390
|
+
*/
|
|
1391
|
+
file?: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* The nesting level of the test.
|
|
1394
|
+
*/
|
|
1395
|
+
nesting: number;
|
|
1396
|
+
}
|
|
1397
|
+
interface TestDequeue {
|
|
1398
|
+
/**
|
|
1399
|
+
* The test name
|
|
1400
|
+
*/
|
|
1401
|
+
name: string;
|
|
1402
|
+
/**
|
|
1403
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1404
|
+
*/
|
|
1405
|
+
file?: string;
|
|
1406
|
+
/**
|
|
1407
|
+
* The nesting level of the test.
|
|
1408
|
+
*/
|
|
1409
|
+
nesting: number;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
1414
|
+
* To access it:
|
|
1415
|
+
*
|
|
1416
|
+
* ```js
|
|
1417
|
+
* import test from 'node:test/reporters';
|
|
1418
|
+
* ```
|
|
1419
|
+
*
|
|
1420
|
+
* This module is only available under the `node:` scheme. The following will not
|
|
1421
|
+
* work:
|
|
1422
|
+
*
|
|
1423
|
+
* ```js
|
|
1424
|
+
* import test from 'test/reporters';
|
|
1425
|
+
* ```
|
|
1426
|
+
* @since v19.9.0
|
|
1427
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js)
|
|
1428
|
+
*/
|
|
1429
|
+
declare module 'node:test/reporters' {
|
|
1430
|
+
import { Transform } from 'node:stream';
|
|
1431
|
+
|
|
1432
|
+
type TestEvent =
|
|
1433
|
+
| { type: 'test:diagnostic', data: DiagnosticData }
|
|
1434
|
+
| { type: 'test:fail', data: TestFail }
|
|
1435
|
+
| { type: 'test:pass', data: TestPass }
|
|
1436
|
+
| { type: 'test:plan', data: TestPlan }
|
|
1437
|
+
| { type: 'test:start', data: TestStart }
|
|
1438
|
+
| { type: 'test:stderr', data: TestStderr }
|
|
1439
|
+
| { type: 'test:stdout', data: TestStdout }
|
|
1440
|
+
| { type: 'test:enqueue', data: TestEnqueue }
|
|
1441
|
+
| { type: 'test:dequeue', data: TestDequeue }
|
|
1442
|
+
| { type: 'test:watch:drained' };
|
|
1443
|
+
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* The `dot` reporter outputs the test results in a compact format,
|
|
1447
|
+
* where each passing test is represented by a `.`,
|
|
1448
|
+
* and each failing test is represented by a `X`.
|
|
1449
|
+
*/
|
|
1450
|
+
function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>;
|
|
1451
|
+
/**
|
|
1452
|
+
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
1453
|
+
*/
|
|
1454
|
+
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
1455
|
+
/**
|
|
1456
|
+
* The `spec` reporter outputs the test results in a human-readable format.
|
|
1457
|
+
*/
|
|
1458
|
+
class Spec extends Transform {
|
|
1459
|
+
constructor();
|
|
1460
|
+
}
|
|
1461
|
+
export { dot, tap, Spec as spec, TestEvent };
|
|
1462
|
+
}
|