@@ -13,16 +13,16 @@ The `common` module is used by tests for consistency across repeated
13
13
tasks.
14
14
15
15
### allowGlobals(...whitelist)
16
- * ` whitelist ` [ < ; Array>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array ) Array of Globals
17
- * return [ < ; Array>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array )
16
+ * ` whitelist ` [ < ; Array>] Array of Globals
17
+ * return [ < ; Array>]
18
18
19
19
Takes ` whitelist ` and concats that with predefined ` knownGlobals ` .
20
20
21
21
### arrayStream
22
22
A stream to push an array into a REPL
23
23
24
24
### busyLoop(time)
25
- * ` time ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type )
25
+ * ` time ` [ < ; Number>]
26
26
27
27
Blocks for ` time ` amount of time.
28
28
@@ -41,177 +41,185 @@ no unexpected rejections occur, because currently they result in silent
41
41
failures.
42
42
43
43
### ddCommand(filename, kilobytes)
44
- * return [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
44
+ * return [ < ; Object>]
45
45
46
46
Platform normalizes the ` dd ` command
47
47
48
48
### enoughTestMem
49
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
49
+ * return [ < ; Boolean>]
50
50
51
51
Check if there is more than 1gb of total memory.
52
52
53
- ### expectsError(settings)
54
- * ` settings ` [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
53
+ ### expectsError([ fn, ] settings[ , exact] )
54
+ * ` fn ` [ < ; Function>]
55
+ * ` settings ` [ < ; Object>]
55
56
with the following optional properties:
56
- * ` code ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
57
+ * ` code ` [ < ; String>]
57
58
expected error must have this value for its ` code ` property
58
- * ` type ` [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function )
59
+ * ` type ` [ < ; Function>]
59
60
expected error must be an instance of ` type `
60
- * ` message ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
61
- or [ < ; RegExp>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp )
61
+ * ` message ` [ < ; String>]
62
+ or [ < ; RegExp>]
62
63
if a string is provided for ` message ` , expected error must have it for its
63
64
` message ` property; if a regular expression is provided for ` message ` , the
64
65
regular expression must match the ` message ` property of the expected error
66
+ * ` exact ` [ < ; Number>] default = 1
65
67
66
68
* return function suitable for use as a validation function passed as the second
67
- argument to ` assert.throws() `
69
+ argument to e.g. ` assert.throws() ` . If the returned function has not been
70
+ called exactly ` exact ` number of times when the test is complete, then the
71
+ test will fail.
72
+
73
+ If ` fn ` is provided, it will be passed to ` assert.throws ` as first argument.
68
74
69
75
The expected error should be [ subclassed by the ` internal/errors ` module] ( https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md#api ) .
70
76
71
77
### expectWarning(name, expected)
72
- * ` name ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
73
- * ` expected ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type ) | [ < ; Array>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array )
78
+ * ` name ` [ < ; String>]
79
+ * ` expected ` [ < ; String>] | [ < ; Array>]
74
80
75
81
Tests whether ` name ` and ` expected ` are part of a raised warning.
76
82
77
83
### fileExists(pathname)
78
- * pathname [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
79
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
84
+ * pathname [ < ; String>]
85
+ * return [ < ; Boolean>]
80
86
81
87
Checks if ` pathname ` exists
82
88
83
89
### fixturesDir
84
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
90
+ * return [ < ; String>]
85
91
86
92
Path to the 'fixtures' directory.
87
93
88
94
### getArrayBufferViews(buf)
89
- * ` buf ` [ < ; Buffer>] ( https://nodejs.org/api/buffer.html#buffer_class_buffer )
90
- * return [ < ; ArrayBufferView[ ;] ; >] ( https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView )
95
+ * ` buf ` [ < ; Buffer>]
96
+ * return [ < ; ArrayBufferView[ ;] ; >]
91
97
92
98
Returns an instance of all possible ` ArrayBufferView ` s of the provided Buffer.
93
99
94
100
### globalCheck
95
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
101
+ * return [ < ; Boolean>]
96
102
97
103
Turn this off if the test should not check for global leaks.
98
104
99
105
### hasCrypto
100
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
106
+ * return [ < ; Boolean>]
101
107
102
108
Checks for 'openssl'.
103
109
104
110
### hasFipsCrypto
105
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
111
+ * return [ < ; Boolean>]
106
112
107
113
Checks ` hasCrypto ` and ` crypto ` with fips.
108
114
109
115
### hasIntl
110
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
116
+ * return [ < ; Boolean>]
111
117
112
118
Checks if [ internationalization] is supported.
113
119
114
120
### hasSmallICU
115
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
121
+ * return [ < ; Boolean>]
116
122
117
123
Checks ` hasIntl ` and ` small-icu ` is supported.
118
124
119
125
### hasIPv6
120
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
126
+ * return [ < ; Boolean>]
121
127
122
128
Checks whether ` IPv6 ` is supported on this platform.
123
129
124
130
### hasMultiLocalhost
125
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
131
+ * return [ < ; Boolean>]
126
132
127
133
Checks if there are multiple localhosts available.
128
134
129
135
### hijackStderr(listener)
130
- * ` listener ` [ < ; Function>] [ MDN-Function ] : a listener with a single parameter called ` data ` .
136
+ * ` listener ` [ < ; Function>] : a listener with a single parameter
137
+ called ` data ` .
131
138
132
139
Eavesdrop to ` process.stderr.write ` calls. Once ` process.stderr.write ` is
133
140
called, ` listener ` will also be called and the ` data ` of ` write ` function will
134
141
be passed to ` listener ` . What's more, ` process.stderr.writeTimes ` is a count of
135
142
the number of calls.
136
143
137
144
### hijackStdout(listener)
138
- * ` listener ` [ < ; Function>] [ MDN-Function ] : a listener with a single parameter called ` data ` .
145
+ * ` listener ` [ < ; Function>] : a listener with a single parameter
146
+ called ` data ` .
139
147
140
148
Eavesdrop to ` process.stdout.write ` calls. Once ` process.stdout.write ` is
141
149
called, ` listener ` will also be called and the ` data ` of ` write ` function will
142
150
be passed to ` listener ` . What's more, ` process.stdout.writeTimes ` is a count of
143
151
the number of calls.
144
152
145
153
### inFreeBSDJail
146
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
154
+ * return [ < ; Boolean>]
147
155
148
156
Checks whether free BSD Jail is true or false.
149
157
150
158
### isAIX
151
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
159
+ * return [ < ; Boolean>]
152
160
153
161
Platform check for Advanced Interactive eXecutive (AIX).
154
162
155
163
### isAlive(pid)
156
- * ` pid ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type )
157
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
164
+ * ` pid ` [ < ; Number>]
165
+ * return [ < ; Boolean>]
158
166
159
167
Attempts to 'kill' ` pid `
160
168
161
169
### isFreeBSD
162
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
170
+ * return [ < ; Boolean>]
163
171
164
172
Platform check for Free BSD.
165
173
166
174
### isLinux
167
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
175
+ * return [ < ; Boolean>]
168
176
169
177
Platform check for Linux.
170
178
171
179
### isLinuxPPCBE
172
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
180
+ * return [ < ; Boolean>]
173
181
174
182
Platform check for Linux on PowerPC.
175
183
176
184
### isOSX
177
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
185
+ * return [ < ; Boolean>]
178
186
179
187
Platform check for macOS.
180
188
181
189
### isSunOS
182
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
190
+ * return [ < ; Boolean>]
183
191
184
192
Platform check for SunOS.
185
193
186
194
### isWindows
187
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
195
+ * return [ < ; Boolean>]
188
196
189
197
Platform check for Windows.
190
198
191
199
### isWOW64
192
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
200
+ * return [ < ; Boolean>]
193
201
194
202
Platform check for Windows 32-bit on Windows 64-bit.
195
203
196
204
### leakedGlobals
197
- * return [ < ; Array>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array )
205
+ * return [ < ; Array>]
198
206
199
207
Checks whether any globals are not on the ` knownGlobals ` list.
200
208
201
209
### localhostIPv4
202
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
210
+ * return [ < ; String>]
203
211
204
212
Gets IP of localhost
205
213
206
214
### localIPv6Hosts
207
- * return [ < ; Array>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array )
215
+ * return [ < ; Array>]
208
216
209
217
Array of IPV6 hosts.
210
218
211
219
### mustCall([ fn] [ , exact ] )
212
- * ` fn ` [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function ) default = () => {}
213
- * ` exact ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type ) default = 1
214
- * return [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function )
220
+ * ` fn ` [ < ; Function>] default = () => {}
221
+ * ` exact ` [ < ; Number>] default = 1
222
+ * return [ < ; Function>]
215
223
216
224
Returns a function that calls ` fn ` . If the returned function has not been called
217
225
exactly ` expected ` number of times when the test is complete, then the test will
@@ -220,9 +228,9 @@ fail.
220
228
If ` fn ` is not provided, an empty function will be used.
221
229
222
230
### mustCallAtLeast([ fn] [ , minimum ] )
223
- * ` fn ` [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function ) default = () => {}
224
- * ` minimum ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type ) default = 1
225
- * return [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function )
231
+ * ` fn ` [ < ; Function>] default = () => {}
232
+ * ` minimum ` [ < ; Number>] default = 1
233
+ * return [ < ; Function>]
226
234
227
235
Returns a function that calls ` fn ` . If the returned function has not been called
228
236
at least ` minimum ` number of times when the test is complete, then the test will
@@ -231,46 +239,49 @@ fail.
231
239
If ` fn ` is not provided, an empty function will be used.
232
240
233
241
### mustNotCall([ msg] )
234
- * ` msg ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type ) default = 'function should not have been called'
235
- * return [ < ; Function>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function )
242
+ * ` msg ` [ < ; String>] default = 'function should not have been called'
243
+ * return [ < ; Function>]
236
244
237
- Returns a function that triggers an ` AssertionError ` if it is invoked. ` msg ` is used as the error message for the ` AssertionError ` .
245
+ Returns a function that triggers an ` AssertionError ` if it is invoked. ` msg ` is
246
+ used as the error message for the ` AssertionError ` .
238
247
239
248
### nodeProcessAborted(exitCode, signal)
240
- * ` exitCode ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type )
241
- * ` signal ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
242
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
249
+ * ` exitCode ` [ < ; Number>]
250
+ * ` signal ` [ < ; String>]
251
+ * return [ < ; Boolean>]
243
252
244
- Returns ` true ` if the exit code ` exitCode ` and/or signal name ` signal ` represent the exit code and/or signal name of a node process that aborted, ` false ` otherwise.
253
+ Returns ` true ` if the exit code ` exitCode ` and/or signal name ` signal ` represent
254
+ the exit code and/or signal name of a node process that aborted, ` false `
255
+ otherwise.
245
256
246
257
### opensslCli
247
- * return [ < ; Boolean>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type )
258
+ * return [ < ; Boolean>]
248
259
249
260
Checks whether 'opensslCli' is supported.
250
261
251
262
### platformTimeout(ms)
252
- * ` ms ` [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type )
253
- * return [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type )
263
+ * ` ms ` [ < ; Number>]
264
+ * return [ < ; Number>]
254
265
255
266
Platform normalizes timeout.
256
267
257
268
### PIPE
258
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
269
+ * return [ < ; String>]
259
270
260
271
Path to the test sock.
261
272
262
273
### PORT
263
- * return [ < ; Number>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type ) default = ` 12346 `
274
+ * return [ < ; Number>] default = ` 12346 `
264
275
265
276
Port tests are running on.
266
277
267
278
### printSkipMessage(msg)
268
- * ` msg ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
279
+ * ` msg ` [ < ; String>]
269
280
270
281
Logs '1..0 # Skipped: ' + ` msg `
271
282
272
283
### refreshTmpDir
273
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
284
+ * return [ < ; String>]
274
285
275
286
Deletes the 'tmp' dir and recreates it
276
287
@@ -283,34 +294,34 @@ Restore the original `process.stderr.write`.
283
294
Restore the original ` process.stdout.write ` .
284
295
285
296
### rootDir
286
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
297
+ * return [ < ; String>]
287
298
288
299
Path to the 'root' directory. either ` / ` or ` c:\\ ` (windows)
289
300
290
301
### skip(msg)
291
- * ` msg ` [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
302
+ * ` msg ` [ < ; String>]
292
303
293
304
Logs '1..0 # Skipped: ' + ` msg ` and exits with exit code ` 0 ` .
294
305
295
306
### spawnPwd(options)
296
- * ` options ` [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
297
- * return [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
307
+ * ` options ` [ < ; Object>]
308
+ * return [ < ; Object>]
298
309
299
310
Platform normalizes the ` pwd ` command.
300
311
301
312
### spawnSyncPwd(options)
302
- * ` options ` [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
303
- * return [ < ; Object>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object )
313
+ * ` options ` [ < ; Object>]
314
+ * return [ < ; Object>]
304
315
305
316
Synchronous version of ` spawnPwd ` .
306
317
307
318
### tmpDir
308
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
319
+ * return [ < ; String>]
309
320
310
321
The realpath of the 'tmp' directory.
311
322
312
323
### tmpDirName
313
- * return [ < ; String>] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type )
324
+ * return [ < ; String>]
314
325
315
326
Name of the temp directory used by tests.
316
327
@@ -323,5 +334,13 @@ Node.js
323
334
implementation with tests from
324
335
[ W3C Web Platform Tests] ( https://github.com/w3c/web-platform-tests ) .
325
336
326
- [ MDN-Function ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Normal_objects_and_functions
337
+ [ < ; Array>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
338
+ [ < ; ArrayBufferView[ ;] ; >] : https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView
339
+ [ < ; Boolean>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type
340
+ [ < ; Buffer>] : https://nodejs.org/api/buffer.html#buffer_class_buffer
341
+ [ < ; Function>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
342
+ [ < ; Number>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
343
+ [ < ; Object>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
344
+ [ < ; RegExp>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
345
+ [ < ; String>] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type
327
346
[ internationalization ] : https://github.com/nodejs/node/wiki/Intl
0 commit comments