|
1 | 1 | # Node.js Core Tests
|
2 | 2 |
|
3 |
| -This folder contains code and data used to test the Node.js implementation. |
| 3 | +This directory contains code and data used to test the Node.js implementation. |
4 | 4 |
|
5 | 5 | For a detailed guide on how to write tests in this
|
6 | 6 | directory, see [the guide on writing tests](../doc/guides/writing-tests.md).
|
7 | 7 |
|
8 | 8 | On how to run tests in this direcotry, see
|
9 | 9 | [the contributing guide](../CONTRIBUTING.md#step-5-test).
|
10 | 10 |
|
11 |
| -## Table of Contents |
12 |
| - |
13 |
| -* [Test directories](#test-directories) |
14 |
| -* [Common module API](#common-module-api) |
15 |
| - |
16 | 11 | ## Test Directories
|
17 | 12 |
|
18 | 13 | <table>
|
@@ -48,6 +43,14 @@ On how to run tests in this direcotry, see
|
48 | 43 | C++ test that is run as part of the build process.
|
49 | 44 | </td>
|
50 | 45 | </tr>
|
| 46 | + <tr> |
| 47 | + <td>common</td> |
| 48 | + <td></td> |
| 49 | + <td> |
| 50 | + Common modules shared among many tests. |
| 51 | + <a href="./common/README.md">[Documentation]</a> |
| 52 | + </td> |
| 53 | + </tr> |
51 | 54 | <tr>
|
52 | 55 | <td>debugger</td>
|
53 | 56 | <td>No</td>
|
@@ -153,240 +156,3 @@ On how to run tests in this direcotry, see
|
153 | 156 | </tr>
|
154 | 157 | </tbody>
|
155 | 158 | </table>
|
156 |
| - |
157 |
| -## Common module API |
158 |
| - |
159 |
| -The common.js module is used by tests for consistency across repeated |
160 |
| -tasks. It has a number of helpful functions and properties to help with |
161 |
| -writing tests. |
162 |
| - |
163 |
| -### allowGlobals(...whitelist) |
164 |
| -* `whitelist` [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) Array of Globals |
165 |
| -* return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) |
166 |
| - |
167 |
| -Takes `whitelist` and concats that with predefined `knownGlobals`. |
168 |
| - |
169 |
| -### arrayStream |
170 |
| -A stream to push an array into a REPL |
171 |
| - |
172 |
| -### busyLoop(time) |
173 |
| -* `time` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
174 |
| - |
175 |
| -Blocks for `time` amount of time. |
176 |
| - |
177 |
| -### crashOnUnhandledRejection() |
178 |
| - |
179 |
| -Installs a `process.on('unhandledRejection')` handler that crashes the process |
180 |
| -after a tick. This is useful for tests that use Promises and need to make sure |
181 |
| -no unexpected rejections occur, because currently they result in silent |
182 |
| -failures. |
183 |
| - |
184 |
| -### ddCommand(filename, kilobytes) |
185 |
| -* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
186 |
| - |
187 |
| -Platform normalizes the `dd` command |
188 |
| - |
189 |
| -### enoughTestMem |
190 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
191 |
| - |
192 |
| -Check if there is more than 1gb of total memory. |
193 |
| - |
194 |
| -### expectWarning(name, expected) |
195 |
| -* `name` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
196 |
| -* `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) |
197 |
| - |
198 |
| -Tests whether `name` and `expected` are part of a raised warning. |
199 |
| - |
200 |
| -### hasCrypto |
201 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
202 |
| - |
203 |
| -Checks for 'openssl'. |
204 |
| - |
205 |
| -### hasFipsCrypto |
206 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
207 |
| - |
208 |
| -Checks `hasCrypto` and `crypto` with fips. |
209 |
| - |
210 |
| -### hasIPv6 |
211 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
212 |
| - |
213 |
| -Checks whether `IPv6` is supported on this platform. |
214 |
| - |
215 |
| -### hasMultiLocalhost |
216 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
217 |
| - |
218 |
| -Checks if there are multiple localhosts available. |
219 |
| - |
220 |
| -### fail(msg) |
221 |
| -* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
222 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
223 |
| - |
224 |
| -Throws an `AssertionError` with `msg` |
225 |
| - |
226 |
| -### fileExists(pathname) |
227 |
| -* pathname [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
228 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
229 |
| - |
230 |
| -Checks if `pathname` exists |
231 |
| - |
232 |
| -### fixturesDir |
233 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
234 |
| - |
235 |
| -Path to the 'fixtures' directory. |
236 |
| - |
237 |
| -### globalCheck |
238 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
239 |
| - |
240 |
| -Turn this off if the test should not check for global leaks. |
241 |
| - |
242 |
| -### inFreeBSDJail |
243 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
244 |
| - |
245 |
| -Checks whether free BSD Jail is true or false. |
246 |
| - |
247 |
| -### isAix |
248 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
249 |
| - |
250 |
| -Platform check for Advanced Interactive eXecutive (AIX). |
251 |
| - |
252 |
| -### isAlive(pid) |
253 |
| -* `pid` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
254 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
255 |
| - |
256 |
| -Attempts to 'kill' `pid` |
257 |
| - |
258 |
| -### isFreeBSD |
259 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
260 |
| - |
261 |
| -Platform check for Free BSD. |
262 |
| - |
263 |
| -### isLinux |
264 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
265 |
| - |
266 |
| -Platform check for Linux. |
267 |
| - |
268 |
| -### isLinuxPPCBE |
269 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
270 |
| - |
271 |
| -Platform check for Linux on PowerPC. |
272 |
| - |
273 |
| -### isOSX |
274 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
275 |
| - |
276 |
| -Platform check for macOS. |
277 |
| - |
278 |
| -### isSunOS |
279 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
280 |
| - |
281 |
| -Platform check for SunOS. |
282 |
| - |
283 |
| -### isWindows |
284 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
285 |
| - |
286 |
| -Platform check for Windows. |
287 |
| - |
288 |
| -### isWOW64 |
289 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
290 |
| - |
291 |
| -Platform check for Windows 32-bit on Windows 64-bit. |
292 |
| - |
293 |
| -### leakedGlobals |
294 |
| -* return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) |
295 |
| - |
296 |
| -Checks whether any globals are not on the `knownGlobals` list. |
297 |
| - |
298 |
| -### localhostIPv4 |
299 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
300 |
| - |
301 |
| -Gets IP of localhost |
302 |
| - |
303 |
| -### localIPv6Hosts |
304 |
| -* return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) |
305 |
| - |
306 |
| -Array of IPV6 hosts. |
307 |
| - |
308 |
| -### mustCall(fn[, expected]) |
309 |
| -* fn [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
310 |
| -* expected [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 |
311 |
| -* return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
312 |
| - |
313 |
| -Returns a function that calls `fn`. If the returned function has not been called |
314 |
| -exactly `expected` number of times when the test is complete, then the test will |
315 |
| -fail. |
316 |
| - |
317 |
| -### nodeProcessAborted(exitCode, signal) |
318 |
| -* `exitCode` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
319 |
| -* `signal` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
320 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
321 |
| - |
322 |
| -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. |
323 |
| - |
324 |
| -### opensslCli |
325 |
| -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
326 |
| - |
327 |
| -Checks whether 'opensslCli' is supported. |
328 |
| - |
329 |
| -### platformTimeout(ms) |
330 |
| -* `ms` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
331 |
| -* return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
332 |
| - |
333 |
| -Platform normalizes timeout. |
334 |
| - |
335 |
| -### PIPE |
336 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
337 |
| - |
338 |
| -Path to the test sock. |
339 |
| - |
340 |
| -### PORT |
341 |
| -* return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = `12346` |
342 |
| - |
343 |
| -Port tests are running on. |
344 |
| - |
345 |
| -### refreshTmpDir |
346 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
347 |
| - |
348 |
| -Deletes the 'tmp' dir and recreates it |
349 |
| - |
350 |
| -### rootDir |
351 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
352 |
| - |
353 |
| -Path to the 'root' directory. either `/` or `c:\\` (windows) |
354 |
| - |
355 |
| -### skip(msg) |
356 |
| -* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
357 |
| - |
358 |
| -Logs '1..0 # Skipped: ' + `msg` |
359 |
| - |
360 |
| -### spawnCat(options) |
361 |
| -* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
362 |
| -* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
363 |
| - |
364 |
| -Platform normalizes the `cat` command. |
365 |
| - |
366 |
| -### spawnPwd(options) |
367 |
| -* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
368 |
| -* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
369 |
| - |
370 |
| -Platform normalizes the `pwd` command. |
371 |
| - |
372 |
| -### spawnSyncCat(options) |
373 |
| -* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
374 |
| -* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
375 |
| - |
376 |
| -Synchronous version of `spawnCat`. |
377 |
| - |
378 |
| -### spawnSyncPwd(options) |
379 |
| -* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
380 |
| -* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
381 |
| - |
382 |
| -Synchronous version of `spawnPwd`. |
383 |
| - |
384 |
| -### tmpDir |
385 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
386 |
| - |
387 |
| -The realpath of the 'tmp' directory. |
388 |
| - |
389 |
| -### tmpDirName |
390 |
| -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
391 |
| - |
392 |
| -Name of the temp directory used by tests. |
0 commit comments