cloudstructs 0.5.7 → 0.6.0
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 +40 -21
- package/assets/slack-events/events.lambda/index.js +4 -1
- package/assets/slack-textract/detect.lambda/index.js +153 -53
- package/assets/static-website/origin-request.edge-lambda/index.js +4 -1
- package/assets/toolkit-cleaner/clean-objects.lambda/index.js +15 -12
- package/lib/codecommit-mirror/index.js +2 -2
- 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/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/clean-objects.lambda.js +12 -12
- 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 +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +146 -112
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +146 -112
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +146 -112
- package/node_modules/@types/is-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/test.d.ts +146 -112
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +146 -112
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +12 -0
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +146 -112
- package/package.json +8 -8
|
@@ -3,140 +3,174 @@
|
|
|
3
3
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/test.js)
|
|
4
4
|
*/
|
|
5
5
|
declare module 'node:test' {
|
|
6
|
-
/**
|
|
7
|
-
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
8
|
-
* function results in the creation of a test point in the TAP output.
|
|
9
|
-
*
|
|
10
|
-
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
|
11
|
-
* related to the current test. Examples include skipping the test, adding additional TAP
|
|
12
|
-
* diagnostic information, or creating subtests.
|
|
13
|
-
*
|
|
14
|
-
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
|
15
|
-
* can usually be discarded for top level tests. However, the return value from subtests should
|
|
16
|
-
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
|
17
|
-
* in the following example.
|
|
18
|
-
*
|
|
19
|
-
* ```js
|
|
20
|
-
* test('top level test', async (t) => {
|
|
21
|
-
* // The setTimeout() in the following subtest would cause it to outlive its
|
|
22
|
-
* // parent test if 'await' is removed on the next line. Once the parent test
|
|
23
|
-
* // completes, it will cancel any outstanding subtests.
|
|
24
|
-
* await t.test('longer running subtest', async (t) => {
|
|
25
|
-
* return new Promise((resolve, reject) => {
|
|
26
|
-
* setTimeout(resolve, 1000);
|
|
27
|
-
* });
|
|
28
|
-
* });
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
* @since v18.0.0
|
|
32
|
-
* @param name The name of the test, which is displayed when reporting test results.
|
|
33
|
-
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
34
|
-
* @param options Configuration options for the test
|
|
35
|
-
* @param fn The function under test. This first argument to this function is a
|
|
36
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
37
|
-
* passed as the second argument. Default: A no-op function.
|
|
38
|
-
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
39
|
-
*/
|
|
40
|
-
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
41
|
-
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
42
|
-
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
43
|
-
function test(fn?: TestFn): Promise<void>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The type of a function under test. This first argument to this function is a
|
|
47
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
48
|
-
* the second argument.
|
|
49
|
-
*/
|
|
50
|
-
type TestFn = ((t: TestContext, done: (result?: any) => void) => any);
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
54
|
-
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
55
|
-
* @since v18.0.0
|
|
56
|
-
*/
|
|
57
|
-
interface TestContext {
|
|
58
|
-
/**
|
|
59
|
-
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
|
60
|
-
* included at the end of the test's results. This function does not return a value.
|
|
61
|
-
* @param message Message to be displayed as a TAP diagnostic.
|
|
62
|
-
* @since v18.0.0
|
|
63
|
-
*/
|
|
64
|
-
diagnostic(message: string): void;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
|
68
|
-
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
|
69
|
-
* command-line option, this function is a no-op.
|
|
70
|
-
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
|
71
|
-
* @since v18.0.0
|
|
72
|
-
*/
|
|
73
|
-
runOnly(shouldRunOnlyTests: boolean): void;
|
|
74
|
-
|
|
75
6
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @
|
|
7
|
+
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
8
|
+
* function results in the creation of a test point in the TAP output.
|
|
9
|
+
*
|
|
10
|
+
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
|
11
|
+
* related to the current test. Examples include skipping the test, adding additional TAP
|
|
12
|
+
* diagnostic information, or creating subtests.
|
|
13
|
+
*
|
|
14
|
+
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
|
15
|
+
* can usually be discarded for top level tests. However, the return value from subtests should
|
|
16
|
+
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
|
17
|
+
* in the following example.
|
|
18
|
+
*
|
|
19
|
+
* ```js
|
|
20
|
+
* test('top level test', async (t) => {
|
|
21
|
+
* // The setTimeout() in the following subtest would cause it to outlive its
|
|
22
|
+
* // parent test if 'await' is removed on the next line. Once the parent test
|
|
23
|
+
* // completes, it will cancel any outstanding subtests.
|
|
24
|
+
* await t.test('longer running subtest', async (t) => {
|
|
25
|
+
* return new Promise((resolve, reject) => {
|
|
26
|
+
* setTimeout(resolve, 1000);
|
|
27
|
+
* });
|
|
28
|
+
* });
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
80
31
|
* @since v18.0.0
|
|
32
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
33
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
34
|
+
* @param options Configuration options for the test
|
|
35
|
+
* @param fn The function under test. The first argument to this function is a
|
|
36
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
37
|
+
* passed as the second argument. Default: A no-op function.
|
|
38
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
81
39
|
*/
|
|
82
|
-
|
|
40
|
+
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
41
|
+
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
42
|
+
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
43
|
+
function test(fn?: TestFn): Promise<void>;
|
|
83
44
|
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param
|
|
89
|
-
* @
|
|
45
|
+
/*
|
|
46
|
+
* @since v18.6.0
|
|
47
|
+
* @param name The name of the suite, which is displayed when reporting suite results.
|
|
48
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
49
|
+
* @param options Configuration options for the suite
|
|
50
|
+
* @param fn The function under suite. Default: A no-op function.
|
|
90
51
|
*/
|
|
91
|
-
|
|
52
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
|
|
53
|
+
function describe(name?: string, fn?: SuiteFn): void;
|
|
54
|
+
function describe(options?: TestOptions, fn?: SuiteFn): void;
|
|
55
|
+
function describe(fn?: SuiteFn): void;
|
|
92
56
|
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
* the same fashion as the top level {@link test} function.
|
|
96
|
-
* @since v18.0.0
|
|
57
|
+
/*
|
|
58
|
+
* @since v18.6.0
|
|
97
59
|
* @param name The name of the test, which is displayed when reporting test results.
|
|
98
60
|
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
99
61
|
* @param options Configuration options for the test
|
|
100
|
-
* @param fn The function under test.
|
|
101
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
62
|
+
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
102
63
|
* passed as the second argument. Default: A no-op function.
|
|
103
|
-
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
104
64
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
65
|
+
function it(name?: string, options?: TestOptions, fn?: ItFn): void;
|
|
66
|
+
function it(name?: string, fn?: ItFn): void;
|
|
67
|
+
function it(options?: TestOptions, fn?: ItFn): void;
|
|
68
|
+
function it(fn?: ItFn): void;
|
|
107
69
|
|
|
108
|
-
interface TestOptions {
|
|
109
70
|
/**
|
|
110
|
-
* The
|
|
111
|
-
*
|
|
112
|
-
*
|
|
71
|
+
* The type of a function under test. The first argument to this function is a
|
|
72
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
73
|
+
* the second argument.
|
|
113
74
|
*/
|
|
114
|
-
|
|
75
|
+
type TestFn = (t: TestContext, done: (result?: any) => void) => any;
|
|
115
76
|
|
|
116
77
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @default false
|
|
78
|
+
* The type of a function under Suite.
|
|
79
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
120
80
|
*/
|
|
121
|
-
|
|
81
|
+
type SuiteFn = (done: (result?: any) => void) => void;
|
|
122
82
|
|
|
123
83
|
/**
|
|
124
|
-
*
|
|
125
|
-
* test
|
|
126
|
-
* @default false
|
|
84
|
+
* The type of a function under test.
|
|
85
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
127
86
|
*/
|
|
128
|
-
|
|
87
|
+
type ItFn = (done: (result?: any) => void) => any;
|
|
129
88
|
|
|
130
89
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @
|
|
90
|
+
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
91
|
+
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
92
|
+
* @since v18.0.0
|
|
134
93
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
94
|
+
interface TestContext {
|
|
95
|
+
/**
|
|
96
|
+
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
|
97
|
+
* included at the end of the test's results. This function does not return a value.
|
|
98
|
+
* @param message Message to be displayed as a TAP diagnostic.
|
|
99
|
+
* @since v18.0.0
|
|
100
|
+
*/
|
|
101
|
+
diagnostic(message: string): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
|
105
|
+
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
|
106
|
+
* command-line option, this function is a no-op.
|
|
107
|
+
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
|
108
|
+
* @since v18.0.0
|
|
109
|
+
*/
|
|
110
|
+
runOnly(shouldRunOnlyTests: boolean): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* This function causes the test's output to indicate the test as skipped. If `message` is
|
|
114
|
+
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
|
|
115
|
+
* the test function. This function does not return a value.
|
|
116
|
+
* @param message Optional skip message to be displayed in TAP output.
|
|
117
|
+
* @since v18.0.0
|
|
118
|
+
*/
|
|
119
|
+
skip(message?: string): void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
|
|
123
|
+
* included in the TAP output. Calling `todo()` does not terminate execution of the test
|
|
124
|
+
* function. This function does not return a value.
|
|
125
|
+
* @param message Optional `TODO` message to be displayed in TAP output.
|
|
126
|
+
* @since v18.0.0
|
|
127
|
+
*/
|
|
128
|
+
todo(message?: string): void;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* This function is used to create subtests under the current test. This function behaves in
|
|
132
|
+
* the same fashion as the top level {@link test} function.
|
|
133
|
+
* @since v18.0.0
|
|
134
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
135
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
136
|
+
* @param options Configuration options for the test
|
|
137
|
+
* @param fn The function under test. This first argument to this function is a
|
|
138
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
139
|
+
* passed as the second argument. Default: A no-op function.
|
|
140
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
141
|
+
*/
|
|
142
|
+
test: typeof test;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface TestOptions {
|
|
146
|
+
/**
|
|
147
|
+
* The number of tests that can be run at the same time. If unspecified, subtests inherit this
|
|
148
|
+
* value from their parent.
|
|
149
|
+
* @default 1
|
|
150
|
+
*/
|
|
151
|
+
concurrency?: number;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* If truthy, and the test context is configured to run `only` tests, then this test will be
|
|
155
|
+
* run. Otherwise, the test is skipped.
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
only?: boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* If truthy, the test is skipped. If a string is provided, that string is displayed in the
|
|
162
|
+
* test results as the reason for skipping the test.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
skip?: boolean | string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
|
|
169
|
+
* the test results as the reason why the test is `TODO`.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
todo?: boolean | string;
|
|
173
|
+
}
|
|
137
174
|
|
|
138
|
-
|
|
139
|
-
test as default,
|
|
140
|
-
test,
|
|
141
|
-
};
|
|
175
|
+
export { test as default, test, describe, it };
|
|
142
176
|
}
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 25 Jul 2022 03:02:21 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 18.
|
|
1
|
+
// Type definitions for non-npm package Node.js 18.6
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.6.1",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -220,6 +220,6 @@
|
|
|
220
220
|
},
|
|
221
221
|
"scripts": {},
|
|
222
222
|
"dependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
223
|
+
"typesPublisherContentHash": "44e628c188a3b958cbf3478d419ce6106d591da55cf4b80f1d8dffa1caae8bf2",
|
|
224
224
|
"typeScriptVersion": "4.0"
|
|
225
225
|
}
|
|
@@ -519,6 +519,18 @@ declare module 'stream' {
|
|
|
519
519
|
* @since v0.9.4
|
|
520
520
|
*/
|
|
521
521
|
class Writable extends Stream implements NodeJS.WritableStream {
|
|
522
|
+
/**
|
|
523
|
+
* A utility method for creating a `Writable` from a web `WritableStream`.
|
|
524
|
+
* @since v17.0.0
|
|
525
|
+
* @experimental
|
|
526
|
+
*/
|
|
527
|
+
static fromWeb(writableStream: streamWeb.WritableStream, options?: Pick<WritableOptions, 'decodeStrings' | 'highWaterMark' | 'objectMode' | 'signal'>): Writable;
|
|
528
|
+
/**
|
|
529
|
+
* A utility method for creating a web `WritableStream` from a `Writable`.
|
|
530
|
+
* @since v17.0.0
|
|
531
|
+
* @experimental
|
|
532
|
+
*/
|
|
533
|
+
static toWeb(streamWritable: Writable): streamWeb.WritableStream;
|
|
522
534
|
/**
|
|
523
535
|
* Is `true` if it is safe to call `writable.write()`, which means
|
|
524
536
|
* the stream has not been destroyed, errored or ended.
|
|
@@ -3,140 +3,174 @@
|
|
|
3
3
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/test.js)
|
|
4
4
|
*/
|
|
5
5
|
declare module 'node:test' {
|
|
6
|
-
/**
|
|
7
|
-
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
8
|
-
* function results in the creation of a test point in the TAP output.
|
|
9
|
-
*
|
|
10
|
-
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
|
11
|
-
* related to the current test. Examples include skipping the test, adding additional TAP
|
|
12
|
-
* diagnostic information, or creating subtests.
|
|
13
|
-
*
|
|
14
|
-
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
|
15
|
-
* can usually be discarded for top level tests. However, the return value from subtests should
|
|
16
|
-
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
|
17
|
-
* in the following example.
|
|
18
|
-
*
|
|
19
|
-
* ```js
|
|
20
|
-
* test('top level test', async (t) => {
|
|
21
|
-
* // The setTimeout() in the following subtest would cause it to outlive its
|
|
22
|
-
* // parent test if 'await' is removed on the next line. Once the parent test
|
|
23
|
-
* // completes, it will cancel any outstanding subtests.
|
|
24
|
-
* await t.test('longer running subtest', async (t) => {
|
|
25
|
-
* return new Promise((resolve, reject) => {
|
|
26
|
-
* setTimeout(resolve, 1000);
|
|
27
|
-
* });
|
|
28
|
-
* });
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
* @since v18.0.0
|
|
32
|
-
* @param name The name of the test, which is displayed when reporting test results.
|
|
33
|
-
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
34
|
-
* @param options Configuration options for the test
|
|
35
|
-
* @param fn The function under test. This first argument to this function is a
|
|
36
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
37
|
-
* passed as the second argument. Default: A no-op function.
|
|
38
|
-
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
39
|
-
*/
|
|
40
|
-
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
41
|
-
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
42
|
-
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
43
|
-
function test(fn?: TestFn): Promise<void>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The type of a function under test. This first argument to this function is a
|
|
47
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
48
|
-
* the second argument.
|
|
49
|
-
*/
|
|
50
|
-
type TestFn = ((t: TestContext, done: (result?: any) => void) => any);
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
54
|
-
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
55
|
-
* @since v18.0.0
|
|
56
|
-
*/
|
|
57
|
-
interface TestContext {
|
|
58
|
-
/**
|
|
59
|
-
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
|
60
|
-
* included at the end of the test's results. This function does not return a value.
|
|
61
|
-
* @param message Message to be displayed as a TAP diagnostic.
|
|
62
|
-
* @since v18.0.0
|
|
63
|
-
*/
|
|
64
|
-
diagnostic(message: string): void;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
|
68
|
-
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
|
69
|
-
* command-line option, this function is a no-op.
|
|
70
|
-
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
|
71
|
-
* @since v18.0.0
|
|
72
|
-
*/
|
|
73
|
-
runOnly(shouldRunOnlyTests: boolean): void;
|
|
74
|
-
|
|
75
6
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @
|
|
7
|
+
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
8
|
+
* function results in the creation of a test point in the TAP output.
|
|
9
|
+
*
|
|
10
|
+
* The {@link TestContext} object passed to the fn argument can be used to perform actions
|
|
11
|
+
* related to the current test. Examples include skipping the test, adding additional TAP
|
|
12
|
+
* diagnostic information, or creating subtests.
|
|
13
|
+
*
|
|
14
|
+
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
|
|
15
|
+
* can usually be discarded for top level tests. However, the return value from subtests should
|
|
16
|
+
* be used to prevent the parent test from finishing first and cancelling the subtest as shown
|
|
17
|
+
* in the following example.
|
|
18
|
+
*
|
|
19
|
+
* ```js
|
|
20
|
+
* test('top level test', async (t) => {
|
|
21
|
+
* // The setTimeout() in the following subtest would cause it to outlive its
|
|
22
|
+
* // parent test if 'await' is removed on the next line. Once the parent test
|
|
23
|
+
* // completes, it will cancel any outstanding subtests.
|
|
24
|
+
* await t.test('longer running subtest', async (t) => {
|
|
25
|
+
* return new Promise((resolve, reject) => {
|
|
26
|
+
* setTimeout(resolve, 1000);
|
|
27
|
+
* });
|
|
28
|
+
* });
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
80
31
|
* @since v18.0.0
|
|
32
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
33
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
34
|
+
* @param options Configuration options for the test
|
|
35
|
+
* @param fn The function under test. The first argument to this function is a
|
|
36
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
37
|
+
* passed as the second argument. Default: A no-op function.
|
|
38
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
81
39
|
*/
|
|
82
|
-
|
|
40
|
+
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
41
|
+
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
42
|
+
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
43
|
+
function test(fn?: TestFn): Promise<void>;
|
|
83
44
|
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param
|
|
89
|
-
* @
|
|
45
|
+
/*
|
|
46
|
+
* @since v18.6.0
|
|
47
|
+
* @param name The name of the suite, which is displayed when reporting suite results.
|
|
48
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
49
|
+
* @param options Configuration options for the suite
|
|
50
|
+
* @param fn The function under suite. Default: A no-op function.
|
|
90
51
|
*/
|
|
91
|
-
|
|
52
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
|
|
53
|
+
function describe(name?: string, fn?: SuiteFn): void;
|
|
54
|
+
function describe(options?: TestOptions, fn?: SuiteFn): void;
|
|
55
|
+
function describe(fn?: SuiteFn): void;
|
|
92
56
|
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
* the same fashion as the top level {@link test} function.
|
|
96
|
-
* @since v18.0.0
|
|
57
|
+
/*
|
|
58
|
+
* @since v18.6.0
|
|
97
59
|
* @param name The name of the test, which is displayed when reporting test results.
|
|
98
60
|
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
99
61
|
* @param options Configuration options for the test
|
|
100
|
-
* @param fn The function under test.
|
|
101
|
-
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
62
|
+
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
102
63
|
* passed as the second argument. Default: A no-op function.
|
|
103
|
-
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
104
64
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
65
|
+
function it(name?: string, options?: TestOptions, fn?: ItFn): void;
|
|
66
|
+
function it(name?: string, fn?: ItFn): void;
|
|
67
|
+
function it(options?: TestOptions, fn?: ItFn): void;
|
|
68
|
+
function it(fn?: ItFn): void;
|
|
107
69
|
|
|
108
|
-
interface TestOptions {
|
|
109
70
|
/**
|
|
110
|
-
* The
|
|
111
|
-
*
|
|
112
|
-
*
|
|
71
|
+
* The type of a function under test. The first argument to this function is a
|
|
72
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is passed as
|
|
73
|
+
* the second argument.
|
|
113
74
|
*/
|
|
114
|
-
|
|
75
|
+
type TestFn = (t: TestContext, done: (result?: any) => void) => any;
|
|
115
76
|
|
|
116
77
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @default false
|
|
78
|
+
* The type of a function under Suite.
|
|
79
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
120
80
|
*/
|
|
121
|
-
|
|
81
|
+
type SuiteFn = (done: (result?: any) => void) => void;
|
|
122
82
|
|
|
123
83
|
/**
|
|
124
|
-
*
|
|
125
|
-
* test
|
|
126
|
-
* @default false
|
|
84
|
+
* The type of a function under test.
|
|
85
|
+
* If the test uses callbacks, the callback function is passed as an argument
|
|
127
86
|
*/
|
|
128
|
-
|
|
87
|
+
type ItFn = (done: (result?: any) => void) => any;
|
|
129
88
|
|
|
130
89
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @
|
|
90
|
+
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
91
|
+
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
92
|
+
* @since v18.0.0
|
|
134
93
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
94
|
+
interface TestContext {
|
|
95
|
+
/**
|
|
96
|
+
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
|
|
97
|
+
* included at the end of the test's results. This function does not return a value.
|
|
98
|
+
* @param message Message to be displayed as a TAP diagnostic.
|
|
99
|
+
* @since v18.0.0
|
|
100
|
+
*/
|
|
101
|
+
diagnostic(message: string): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
|
|
105
|
+
* option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
|
|
106
|
+
* command-line option, this function is a no-op.
|
|
107
|
+
* @param shouldRunOnlyTests Whether or not to run `only` tests.
|
|
108
|
+
* @since v18.0.0
|
|
109
|
+
*/
|
|
110
|
+
runOnly(shouldRunOnlyTests: boolean): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* This function causes the test's output to indicate the test as skipped. If `message` is
|
|
114
|
+
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
|
|
115
|
+
* the test function. This function does not return a value.
|
|
116
|
+
* @param message Optional skip message to be displayed in TAP output.
|
|
117
|
+
* @since v18.0.0
|
|
118
|
+
*/
|
|
119
|
+
skip(message?: string): void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
|
|
123
|
+
* included in the TAP output. Calling `todo()` does not terminate execution of the test
|
|
124
|
+
* function. This function does not return a value.
|
|
125
|
+
* @param message Optional `TODO` message to be displayed in TAP output.
|
|
126
|
+
* @since v18.0.0
|
|
127
|
+
*/
|
|
128
|
+
todo(message?: string): void;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* This function is used to create subtests under the current test. This function behaves in
|
|
132
|
+
* the same fashion as the top level {@link test} function.
|
|
133
|
+
* @since v18.0.0
|
|
134
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
135
|
+
* Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
|
|
136
|
+
* @param options Configuration options for the test
|
|
137
|
+
* @param fn The function under test. This first argument to this function is a
|
|
138
|
+
* {@link TestContext} object. If the test uses callbacks, the callback function is
|
|
139
|
+
* passed as the second argument. Default: A no-op function.
|
|
140
|
+
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
141
|
+
*/
|
|
142
|
+
test: typeof test;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface TestOptions {
|
|
146
|
+
/**
|
|
147
|
+
* The number of tests that can be run at the same time. If unspecified, subtests inherit this
|
|
148
|
+
* value from their parent.
|
|
149
|
+
* @default 1
|
|
150
|
+
*/
|
|
151
|
+
concurrency?: number;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* If truthy, and the test context is configured to run `only` tests, then this test will be
|
|
155
|
+
* run. Otherwise, the test is skipped.
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
only?: boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* If truthy, the test is skipped. If a string is provided, that string is displayed in the
|
|
162
|
+
* test results as the reason for skipping the test.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
skip?: boolean | string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
|
|
169
|
+
* the test results as the reason why the test is `TODO`.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
todo?: boolean | string;
|
|
173
|
+
}
|
|
137
174
|
|
|
138
|
-
|
|
139
|
-
test as default,
|
|
140
|
-
test,
|
|
141
|
-
};
|
|
175
|
+
export { test as default, test, describe, it };
|
|
142
176
|
}
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 25 Jul 2022 03:02:21 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 18.
|
|
1
|
+
// Type definitions for non-npm package Node.js 18.6
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|