mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
doc: prepare markdown file for upcoming formatting/linting
PR-URL: https://github.com/nodejs/node/pull/40156 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
0c95dead55
commit
f4a350da85
4 files changed
+152
-136
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ For the tests to run on Windows, be sure to clone Node.js source code with the
|
||||
| ---------------- | ---------- | --------------- |
|
||||
| `abort` | Yes | Tests that use `--abort-on-uncaught-exception` and other situations where we want to test something but avoid generating a core file. |
|
||||
| `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon. |
|
||||
| `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. |
|
||||
| `async-hooks` | Yes | Tests for [async\_hooks](https://nodejs.org/api/async\_hooks.html) functionality. |
|
||||
| `benchmark` | Yes | Test minimal functionality of benchmarks. |
|
||||
| `cctest` | Yes | C++ tests that are run as part of the build process. |
|
||||
| `code-cache` | No | Tests for a Node.js binary compiled with V8 code cache. |
|
||||
|
||||
+148
-135
@@ -31,10 +31,10 @@ The `benchmark` module is used by tests to run benchmarks.
|
||||
|
||||
### `runBenchmark(name, args, env)`
|
||||
|
||||
* `name` [<string>][] Name of benchmark suite to be run.
|
||||
* `args` [<Array>][] Array of environment variable key/value pairs (ex:
|
||||
* `name` [\<string>][] Name of benchmark suite to be run.
|
||||
* `args` [\<Array>][] Array of environment variable key/value pairs (ex:
|
||||
`n=1`) to be applied via `--set`.
|
||||
* `env` [<Object>][] Environment variables to be applied during the run.
|
||||
* `env` [\<Object>][] Environment variables to be applied during the run.
|
||||
|
||||
## Common Module API
|
||||
|
||||
@@ -43,19 +43,19 @@ tasks.
|
||||
|
||||
### `allowGlobals(...allowlist)`
|
||||
|
||||
* `allowlist` [<Array>][] Array of Globals
|
||||
* return [<Array>][]
|
||||
* `allowlist` [\<Array>][] Array of Globals
|
||||
* return [\<Array>][]
|
||||
|
||||
Takes `allowlist` and concats that with predefined `knownGlobals`.
|
||||
|
||||
### `canCreateSymLink()`
|
||||
|
||||
* return [<boolean>][]
|
||||
* return [\<boolean>][]
|
||||
|
||||
Checks whether the current running process can create symlinks. On Windows, this
|
||||
returns `false` if the process running doesn't have privileges to create
|
||||
symlinks
|
||||
([SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx)).
|
||||
([SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716\(v=vs.85\).aspx)).
|
||||
On non-Windows platforms, this always returns `true`.
|
||||
|
||||
### `createZeroFilledFile(filename)`
|
||||
@@ -64,17 +64,17 @@ Creates a 10 MB file of all null characters.
|
||||
|
||||
### `enoughTestMem`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates if there is more than 1gb of total memory.
|
||||
|
||||
### `expectsError(validator[, exact])`
|
||||
|
||||
* `validator` [<Object>][] | [<RegExp>][] | [<Function>][] |
|
||||
[<Error>][] The validator behaves identical to
|
||||
* `validator` [\<Object>][] | [\<RegExp>][] | [\<Function>][] |
|
||||
[\<Error>][] The validator behaves identical to
|
||||
`assert.throws(fn, validator)`.
|
||||
* `exact` [<number>][] default = 1
|
||||
* return [<Function>][] A callback function that expects an error.
|
||||
* `exact` [\<number>][] default = 1
|
||||
* return [\<Function>][] A callback function that expects an error.
|
||||
|
||||
A function suitable as callback to validate callback based errors. The error is
|
||||
validated using `assert.throws(() => { throw error; }, validator)`. If the
|
||||
@@ -83,9 +83,9 @@ test is complete, then the test will fail.
|
||||
|
||||
### `expectWarning(name[, expected[, code]])`
|
||||
|
||||
* `name` [<string>][] | [<Object>][]
|
||||
* `expected` [<string>][] | [<Array>][] | [<Object>][]
|
||||
* `code` [<string>][]
|
||||
* `name` [\<string>][] | [\<Object>][]
|
||||
* `expected` [\<string>][] | [\<Array>][] | [\<Object>][]
|
||||
* `code` [\<string>][]
|
||||
|
||||
Tests whether `name`, `expected`, and `code` are part of a raised warning.
|
||||
|
||||
@@ -130,23 +130,23 @@ expectWarning({
|
||||
|
||||
### `getArrayBufferViews(buf)`
|
||||
|
||||
* `buf` [<Buffer>][]
|
||||
* return [<ArrayBufferView>][]\[\]
|
||||
* `buf` [\<Buffer>][]
|
||||
* return [\<ArrayBufferView>][]\[]
|
||||
|
||||
Returns an instance of all possible `ArrayBufferView`s of the provided Buffer.
|
||||
|
||||
### `getBufferSources(buf)`
|
||||
|
||||
* `buf` [<Buffer>][]
|
||||
* return [<BufferSource>][]\[\]
|
||||
* `buf` [\<Buffer>][]
|
||||
* return [\<BufferSource>][]\[]
|
||||
|
||||
Returns an instance of all possible `BufferSource`s of the provided Buffer,
|
||||
consisting of all `ArrayBufferView` and an `ArrayBuffer`.
|
||||
|
||||
### `getCallSite(func)`
|
||||
|
||||
* `func` [<Function>][]
|
||||
* return [<string>][]
|
||||
* `func` [\<Function>][]
|
||||
* return [\<string>][]
|
||||
|
||||
Returns the file name and line number for the provided Function.
|
||||
|
||||
@@ -158,13 +158,13 @@ The TTY file descriptor is assumed to be capable of being writable.
|
||||
|
||||
### `hasCrypto`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates whether OpenSSL is available.
|
||||
|
||||
### `hasFipsCrypto`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates that Node.js has been linked with a FIPS compatible OpenSSL library,
|
||||
and that FIPS as been enabled using `--enable-fips`.
|
||||
@@ -175,104 +175,104 @@ used to determine that situation.
|
||||
|
||||
### `hasIntl`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates if [internationalization][] is supported.
|
||||
|
||||
### `hasIPv6`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates whether `IPv6` is supported on this platform.
|
||||
|
||||
### `hasMultiLocalhost`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates if there are multiple localhosts available.
|
||||
|
||||
### `inFreeBSDJail`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Checks whether free BSD Jail is true or false.
|
||||
|
||||
### `isAIX`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for Advanced Interactive eXecutive (AIX).
|
||||
|
||||
### `isAlive(pid)`
|
||||
|
||||
* `pid` [<number>][]
|
||||
* return [<boolean>][]
|
||||
* `pid` [\<number>][]
|
||||
* return [\<boolean>][]
|
||||
|
||||
Attempts to 'kill' `pid`
|
||||
|
||||
### `isDumbTerminal`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
### `isFreeBSD`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for Free BSD.
|
||||
|
||||
### `isIBMi`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for IBMi.
|
||||
|
||||
### `isLinux`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for Linux.
|
||||
|
||||
### `isLinuxPPCBE`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for Linux on PowerPC.
|
||||
|
||||
### `isOSX`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for macOS.
|
||||
|
||||
### `isSunOS`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for SunOS.
|
||||
|
||||
### `isWindows`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Platform check for Windows.
|
||||
|
||||
### `localhostIPv4`
|
||||
|
||||
* [<string>][]
|
||||
* [\<string>][]
|
||||
|
||||
IP of `localhost`.
|
||||
|
||||
### `localIPv6Hosts`
|
||||
|
||||
* [<Array>][]
|
||||
* [\<Array>][]
|
||||
|
||||
Array of IPV6 representations for `localhost`.
|
||||
|
||||
### `mustCall([fn][, exact])`
|
||||
|
||||
* `fn` [<Function>][] default = () => {}
|
||||
* `exact` [<number>][] default = 1
|
||||
* return [<Function>][]
|
||||
* `fn` [\<Function>][] default = () => {}
|
||||
* `exact` [\<number>][] default = 1
|
||||
* return [\<Function>][]
|
||||
|
||||
Returns a function that calls `fn`. If the returned function has not been called
|
||||
exactly `exact` number of times when the test is complete, then the test will
|
||||
@@ -282,9 +282,9 @@ If `fn` is not provided, an empty function will be used.
|
||||
|
||||
### `mustCallAtLeast([fn][, minimum])`
|
||||
|
||||
* `fn` [<Function>][] default = () => {}
|
||||
* `minimum` [<number>][] default = 1
|
||||
* return [<Function>][]
|
||||
* `fn` [\<Function>][] default = () => {}
|
||||
* `minimum` [\<number>][] default = 1
|
||||
* return [\<Function>][]
|
||||
|
||||
Returns a function that calls `fn`. If the returned function has not been called
|
||||
at least `minimum` number of times when the test is complete, then the test will
|
||||
@@ -294,16 +294,16 @@ If `fn` is not provided, an empty function will be used.
|
||||
|
||||
### `mustNotCall([msg])`
|
||||
|
||||
* `msg` [<string>][] default = 'function should not have been called'
|
||||
* return [<Function>][]
|
||||
* `msg` [\<string>][] default = 'function should not have been called'
|
||||
* return [\<Function>][]
|
||||
|
||||
Returns a function that triggers an `AssertionError` if it is invoked. `msg` is
|
||||
used as the error message for the `AssertionError`.
|
||||
|
||||
### `mustSucceed([fn])`
|
||||
|
||||
* `fn` [<Function>][] default = () => {}
|
||||
* return [<Function>][]
|
||||
* `fn` [\<Function>][] default = () => {}
|
||||
* return [\<Function>][]
|
||||
|
||||
Returns a function that accepts arguments `(err, ...args)`. If `err` is not
|
||||
`undefined` or `null`, it triggers an `AssertionError`. Otherwise, it calls
|
||||
@@ -311,9 +311,9 @@ Returns a function that accepts arguments `(err, ...args)`. If `err` is not
|
||||
|
||||
### `nodeProcessAborted(exitCode, signal)`
|
||||
|
||||
* `exitCode` [<number>][]
|
||||
* `signal` [<string>][]
|
||||
* return [<boolean>][]
|
||||
* `exitCode` [\<number>][]
|
||||
* `signal` [\<string>][]
|
||||
* return [\<boolean>][]
|
||||
|
||||
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`
|
||||
@@ -321,14 +321,14 @@ otherwise.
|
||||
|
||||
### `opensslCli`
|
||||
|
||||
* [<boolean>][]
|
||||
* [\<boolean>][]
|
||||
|
||||
Indicates whether 'opensslCli' is supported.
|
||||
|
||||
### `platformTimeout(ms)`
|
||||
|
||||
* `ms` [<number>][] | [<bigint>][]
|
||||
* return [<number>][] | [<bigint>][]
|
||||
* `ms` [\<number>][] | [\<bigint>][]
|
||||
* return [\<number>][] | [\<bigint>][]
|
||||
|
||||
Returns a timeout value based on detected conditions. For example, a debug build
|
||||
may need extra time so the returned value will be larger than on a release
|
||||
@@ -336,27 +336,28 @@ build.
|
||||
|
||||
### `PIPE`
|
||||
|
||||
* [<string>][]
|
||||
* [\<string>][]
|
||||
|
||||
Path to the test socket.
|
||||
|
||||
### `PORT`
|
||||
|
||||
* [<number>][]
|
||||
* [\<number>][]
|
||||
|
||||
A port number for tests to use if one is needed.
|
||||
|
||||
### `printSkipMessage(msg)`
|
||||
|
||||
* `msg` [<string>][]
|
||||
* `msg` [\<string>][]
|
||||
|
||||
Logs '1..0 # Skipped: ' + `msg`
|
||||
|
||||
### `pwdCommand`
|
||||
|
||||
* [<array>][] First two argument for the `spawn`/`exec` functions.
|
||||
* [\<array>][] First two argument for the `spawn`/`exec` functions.
|
||||
|
||||
Platform normalized `pwd` command options. Usage example:
|
||||
|
||||
```js
|
||||
const common = require('../common');
|
||||
const { spawn } = require('child_process');
|
||||
@@ -366,14 +367,14 @@ spawn(...common.pwdCommand, { stdio: ['pipe'] });
|
||||
|
||||
### `requireNoPackageJSONAbove([dir])`
|
||||
|
||||
* `dir` [<string>][] default = \_\_dirname
|
||||
* `dir` [\<string>][] default = \_\_dirname
|
||||
|
||||
Throws an `AssertionError` if a `package.json` file exists in any ancestor
|
||||
directory above `dir`. Such files may interfere with proper test functionality.
|
||||
|
||||
### `runWithInvalidFD(func)`
|
||||
|
||||
* `func` [<Function>][]
|
||||
* `func` [\<Function>][]
|
||||
|
||||
Runs `func` with an invalid file descriptor that is an unsigned integer and
|
||||
can be used to trigger `EBADF` as the first argument. If no such file
|
||||
@@ -382,7 +383,7 @@ will not be run.
|
||||
|
||||
### `skip(msg)`
|
||||
|
||||
* `msg` [<string>][]
|
||||
* `msg` [\<string>][]
|
||||
|
||||
Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`.
|
||||
|
||||
@@ -416,6 +417,7 @@ The `ArrayStream` module provides a simple `Stream` that pushes elements from
|
||||
a given array.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const ArrayStream = require('../common/arraystream');
|
||||
const stream = new ArrayStream();
|
||||
@@ -432,6 +434,7 @@ tasks (for instance, shutting down an HTTP server after a specific number of
|
||||
requests). The Countdown will fail the test if the remainder did not reach 0.
|
||||
|
||||
<!-- eslint-disable strict, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const Countdown = require('../common/countdown');
|
||||
|
||||
@@ -466,14 +469,14 @@ The `cpu-prof` module provides utilities related to CPU profiling tests.
|
||||
|
||||
### `env`
|
||||
|
||||
* Default: { ...process.env, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
|
||||
* Default: { ...process.env, NODE\_DEBUG\_NATIVE: 'INSPECTOR\_PROFILER' }
|
||||
|
||||
Environment variables used in profiled processes.
|
||||
|
||||
### `getCpuProfiles(dir)`
|
||||
|
||||
* `dir` {string} The directory containing the CPU profile files.
|
||||
* return [<string>][]
|
||||
* return [\<string>][]
|
||||
|
||||
Returns an array of all `.cpuprofile` files found in `dir`.
|
||||
|
||||
@@ -481,7 +484,7 @@ Returns an array of all `.cpuprofile` files found in `dir`.
|
||||
|
||||
* `file` {string} Path to a `.cpuprofile` file.
|
||||
* `suffix` {string} Suffix of the URL of call frames to retrieve.
|
||||
* returns { frames: [<Object>][], nodes: [<Object>][] }
|
||||
* returns { frames: [\<Object>][], nodes: [\<Object>][] }
|
||||
|
||||
Returns an object containing an array of the relevant call frames and an array
|
||||
of all the profile nodes.
|
||||
@@ -505,10 +508,10 @@ Provides common functionality for tests for `node inspect`.
|
||||
|
||||
### `startCLI(args[[, flags], spawnOpts])`
|
||||
|
||||
* `args` [<string>][]
|
||||
* `flags` [<string>][] default = []
|
||||
* `showOpts` [<Object>][] default = {}
|
||||
* return [<Object>][]
|
||||
* `args` [\<string>][]
|
||||
* `flags` [\<string>][] default = \[]
|
||||
* `showOpts` [\<Object>][] default = {}
|
||||
* return [\<Object>][]
|
||||
|
||||
Returns a null-prototype object with properties that are functions and getters
|
||||
used to interact with the `node inspect` CLI. These functions are:
|
||||
@@ -533,9 +536,9 @@ The `DNS` module provides utilities related to the `dns` built-in module.
|
||||
|
||||
### `errorLookupMock(code, syscall)`
|
||||
|
||||
* `code` [<string>][] Defaults to `dns.mockedErrorCode`.
|
||||
* `syscall` [<string>][] Defaults to `dns.mockedSysCall`.
|
||||
* return [<Function>][]
|
||||
* `code` [\<string>][] Defaults to `dns.mockedErrorCode`.
|
||||
* `syscall` [\<string>][] Defaults to `dns.mockedSysCall`.
|
||||
* return [\<Function>][]
|
||||
|
||||
A mock for the `lookup` option of `net.connect()` that would result in an error
|
||||
with the `code` and the `syscall` specified. Returns a function that has the
|
||||
@@ -551,39 +554,39 @@ The default `syscall` of errors generated by `errorLookupMock`.
|
||||
|
||||
### `readDomainFromPacket(buffer, offset)`
|
||||
|
||||
* `buffer` [<Buffer>][]
|
||||
* `offset` [<number>][]
|
||||
* return [<Object>][]
|
||||
* `buffer` [\<Buffer>][]
|
||||
* `offset` [\<number>][]
|
||||
* return [\<Object>][]
|
||||
|
||||
Reads the domain string from a packet and returns an object containing the
|
||||
number of bytes read and the domain.
|
||||
|
||||
### `parseDNSPacket(buffer)`
|
||||
|
||||
* `buffer` [<Buffer>][]
|
||||
* return [<Object>][]
|
||||
* `buffer` [\<Buffer>][]
|
||||
* return [\<Object>][]
|
||||
|
||||
Parses a DNS packet. Returns an object with the values of the various flags of
|
||||
the packet depending on the type of packet.
|
||||
|
||||
### `writeIPv6(ip)`
|
||||
|
||||
* `ip` [<string>][]
|
||||
* return [<Buffer>][]
|
||||
* `ip` [\<string>][]
|
||||
* return [\<Buffer>][]
|
||||
|
||||
Reads an IPv6 String and returns a Buffer containing the parts.
|
||||
|
||||
### `writeDomainName(domain)`
|
||||
|
||||
* `domain` [<string>][]
|
||||
* return [<Buffer>][]
|
||||
* `domain` [\<string>][]
|
||||
* return [\<Buffer>][]
|
||||
|
||||
Reads a Domain String and returns a Buffer containing the domain.
|
||||
|
||||
### `writeDNSPacket(parsed)`
|
||||
|
||||
* `parsed` [<Object>][]
|
||||
* return [<Buffer>][]
|
||||
* `parsed` [\<Object>][]
|
||||
* return [\<Buffer>][]
|
||||
|
||||
Takes in a parsed Object and writes its fields to a DNS packet as a Buffer
|
||||
object.
|
||||
@@ -604,7 +607,7 @@ environment variables.
|
||||
### `NODE_COMMON_PORT`
|
||||
|
||||
If set, `NODE_COMMON_PORT`'s value overrides the `common.PORT` default value of
|
||||
12346.
|
||||
12346\.
|
||||
|
||||
### `NODE_SKIP_FLAG_CHECK`
|
||||
|
||||
@@ -627,26 +630,26 @@ files in the `test/fixtures` directory.
|
||||
|
||||
### `fixtures.fixturesDir`
|
||||
|
||||
* [<string>][]
|
||||
* [\<string>][]
|
||||
|
||||
The absolute path to the `test/fixtures/` directory.
|
||||
|
||||
### `fixtures.path(...args)`
|
||||
|
||||
* `...args` [<string>][]
|
||||
* `...args` [\<string>][]
|
||||
|
||||
Returns the result of `path.join(fixtures.fixturesDir, ...args)`.
|
||||
|
||||
### `fixtures.readSync(args[, enc])`
|
||||
|
||||
* `args` [<string>][] | [<Array>][]
|
||||
* `args` [\<string>][] | [\<Array>][]
|
||||
|
||||
Returns the result of
|
||||
`fs.readFileSync(path.join(fixtures.fixturesDir, ...args), 'enc')`.
|
||||
|
||||
### `fixtures.readKey(arg[, enc])`
|
||||
|
||||
* `arg` [<string>][]
|
||||
* `arg` [\<string>][]
|
||||
|
||||
Returns the result of
|
||||
`fs.readFileSync(path.join(fixtures.fixturesDir, 'keys', arg), 'enc')`.
|
||||
@@ -665,16 +668,17 @@ one listed below. (`heap.validateSnapshotNodes(...)` is a shortcut for
|
||||
|
||||
### `heap.validateSnapshotNodes(name, expected, options)`
|
||||
|
||||
* `name` [<string>][] Look for this string as the name of heap dump nodes.
|
||||
* `expected` [<Array>][] A list of objects, possibly with an `children`
|
||||
* `name` [\<string>][] Look for this string as the name of heap dump nodes.
|
||||
* `expected` [\<Array>][] A list of objects, possibly with an `children`
|
||||
property that points to expected other adjacent nodes.
|
||||
* `options` [<Array>][]
|
||||
* `loose` [<boolean>][] Do not expect an exact listing of occurrences
|
||||
* `options` [\<Array>][]
|
||||
* `loose` [\<boolean>][] Do not expect an exact listing of occurrences
|
||||
of nodes with name `name` in `expected`.
|
||||
|
||||
Create a heap dump and an embedder graph copy and validate occurrences.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
validateSnapshotNodes('TLSWRAP', [
|
||||
{
|
||||
@@ -693,6 +697,7 @@ The `hijackstdio` module provides utility functions for temporarily redirecting
|
||||
`stdout` and `stderr` output.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const { hijackStdout, restoreStdout } = require('../common/hijackstdio');
|
||||
|
||||
@@ -706,7 +711,7 @@ console.log('this is sent to the hijacked listener');
|
||||
|
||||
### `hijackStderr(listener)`
|
||||
|
||||
* `listener` [<Function>][]: a listener with a single parameter
|
||||
* `listener` [\<Function>][]: a listener with a single parameter
|
||||
called `data`.
|
||||
|
||||
Eavesdrop to `process.stderr.write()` calls. Once `process.stderr.write()` is
|
||||
@@ -716,7 +721,7 @@ the number of calls.
|
||||
|
||||
### `hijackStdout(listener)`
|
||||
|
||||
* `listener` [<Function>][]: a listener with a single parameter
|
||||
* `listener` [\<Function>][]: a listener with a single parameter
|
||||
called `data`.
|
||||
|
||||
Eavesdrop to `process.stdout.write()` calls. Once `process.stdout.write()` is
|
||||
@@ -740,6 +745,7 @@ The http2.js module provides a handful of utilities for creating mock HTTP/2
|
||||
frames for testing of HTTP/2 endpoints
|
||||
|
||||
<!-- eslint-disable no-unused-vars, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const http2 = require('../common/http2');
|
||||
```
|
||||
@@ -750,6 +756,7 @@ The `http2.Frame` is a base class that creates a `Buffer` containing a
|
||||
serialized HTTP/2 frame header.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
// length is a 24-bit unsigned integer
|
||||
// type is an 8-bit unsigned integer identifying the frame type
|
||||
@@ -769,6 +776,7 @@ The `http2.DataFrame` is a subclass of `http2.Frame` that serializes a `DATA`
|
||||
frame.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
// id is the 32-bit stream identifier
|
||||
// payload is a Buffer containing the DATA payload
|
||||
@@ -786,6 +794,7 @@ The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a
|
||||
`HEADERS` frame.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
// id is the 32-bit stream identifier
|
||||
// payload is a Buffer containing the HEADERS payload (see either
|
||||
@@ -804,6 +813,7 @@ The `http2.SettingsFrame` is a subclass of `http2.Frame` that serializes an
|
||||
empty `SETTINGS` frame.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
// ack is a boolean indicating whether or not to set the ACK flag.
|
||||
const frame = new http2.SettingsFrame(ack);
|
||||
@@ -817,6 +827,7 @@ Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2
|
||||
request headers to be used as the payload of a `http2.HeadersFrame`.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const frame = new http2.HeadersFrame(1, http2.kFakeRequestHeaders, 0, true);
|
||||
|
||||
@@ -829,6 +840,7 @@ Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2
|
||||
response headers to be used as the payload a `http2.HeadersFrame`.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
const frame = new http2.HeadersFrame(1, http2.kFakeResponseHeaders, 0, true);
|
||||
|
||||
@@ -841,6 +853,7 @@ Set to a `Buffer` containing the preamble bytes an HTTP/2 client must send
|
||||
upon initial establishment of a connection.
|
||||
|
||||
<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->
|
||||
|
||||
```js
|
||||
socket.write(http2.kClientMagic);
|
||||
```
|
||||
@@ -852,27 +865,27 @@ internet-related tests.
|
||||
|
||||
### `internet.addresses`
|
||||
|
||||
* [<Object>][]
|
||||
* `INET_HOST` [<string>][] A generic host that has registered common
|
||||
* [\<Object>][]
|
||||
* `INET_HOST` [\<string>][] A generic host that has registered common
|
||||
DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS
|
||||
services
|
||||
* `INET4_HOST` [<string>][] A host that provides IPv4 services
|
||||
* `INET6_HOST` [<string>][] A host that provides IPv6 services
|
||||
* `INET4_IP` [<string>][] An accessible IPv4 IP, defaults to the
|
||||
* `INET4_HOST` [\<string>][] A host that provides IPv4 services
|
||||
* `INET6_HOST` [\<string>][] A host that provides IPv6 services
|
||||
* `INET4_IP` [\<string>][] An accessible IPv4 IP, defaults to the
|
||||
Google Public DNS IPv4 address
|
||||
* `INET6_IP` [<string>][] An accessible IPv6 IP, defaults to the
|
||||
* `INET6_IP` [\<string>][] An accessible IPv6 IP, defaults to the
|
||||
Google Public DNS IPv6 address
|
||||
* `INVALID_HOST` [<string>][] An invalid host that cannot be resolved
|
||||
* `MX_HOST` [<string>][] A host with MX records registered
|
||||
* `SRV_HOST` [<string>][] A host with SRV records registered
|
||||
* `PTR_HOST` [<string>][] A host with PTR records registered
|
||||
* `NAPTR_HOST` [<string>][] A host with NAPTR records registered
|
||||
* `SOA_HOST` [<string>][] A host with SOA records registered
|
||||
* `CNAME_HOST` [<string>][] A host with CNAME records registered
|
||||
* `NS_HOST` [<string>][] A host with NS records registered
|
||||
* `TXT_HOST` [<string>][] A host with TXT records registered
|
||||
* `DNS4_SERVER` [<string>][] An accessible IPv4 DNS server
|
||||
* `DNS6_SERVER` [<string>][] An accessible IPv6 DNS server
|
||||
* `INVALID_HOST` [\<string>][] An invalid host that cannot be resolved
|
||||
* `MX_HOST` [\<string>][] A host with MX records registered
|
||||
* `SRV_HOST` [\<string>][] A host with SRV records registered
|
||||
* `PTR_HOST` [\<string>][] A host with PTR records registered
|
||||
* `NAPTR_HOST` [\<string>][] A host with NAPTR records registered
|
||||
* `SOA_HOST` [\<string>][] A host with SOA records registered
|
||||
* `CNAME_HOST` [\<string>][] A host with CNAME records registered
|
||||
* `NS_HOST` [\<string>][] A host with NS records registered
|
||||
* `TXT_HOST` [\<string>][] A host with TXT records registered
|
||||
* `DNS4_SERVER` [\<string>][] An accessible IPv4 DNS server
|
||||
* `DNS6_SERVER` [\<string>][] An accessible IPv6 DNS server
|
||||
|
||||
A set of addresses for internet-related tests. All properties are configurable
|
||||
via `NODE_TEST_*` environment variables. For example, to configure
|
||||
@@ -893,9 +906,9 @@ onGC({}, { ongc() { console.log('collected'); } });
|
||||
|
||||
### `onGC(target, listener)`
|
||||
|
||||
* `target` [<Object>][]
|
||||
* `listener` [<Object>][]
|
||||
* `ongc` [<Function>][]
|
||||
* `target` [\<Object>][]
|
||||
* `listener` [\<Object>][]
|
||||
* `ongc` [\<Function>][]
|
||||
|
||||
Installs a GC listener for the collection of `target`.
|
||||
|
||||
@@ -914,23 +927,23 @@ functionality.
|
||||
|
||||
### `findReports(pid, dir)`
|
||||
|
||||
* `pid` [<number>][] Process ID to retrieve diagnostic report files for.
|
||||
* `dir` [<string>][] Directory to search for diagnostic report files.
|
||||
* return [<Array>][]
|
||||
* `pid` [\<number>][] Process ID to retrieve diagnostic report files for.
|
||||
* `dir` [\<string>][] Directory to search for diagnostic report files.
|
||||
* return [\<Array>][]
|
||||
|
||||
Returns an array of diagnostic report file names found in `dir`. The files
|
||||
should have been generated by a process whose PID matches `pid`.
|
||||
|
||||
### `validate(filepath)`
|
||||
|
||||
* `filepath` [<string>][] Diagnostic report filepath to validate.
|
||||
* `filepath` [\<string>][] Diagnostic report filepath to validate.
|
||||
|
||||
Validates the schema of a diagnostic report file whose path is specified in
|
||||
`filepath`. If the report fails validation, an exception is thrown.
|
||||
|
||||
### `validateContent(report)`
|
||||
|
||||
* `report` [<Object>][] | [<string>][] JSON contents of a diagnostic
|
||||
* `report` [\<Object>][] | [\<string>][] JSON contents of a diagnostic
|
||||
report file, the parsed Object thereof, or the result of
|
||||
`process.report.getReport()`.
|
||||
|
||||
@@ -944,8 +957,8 @@ after a given number of event loop "ticks".
|
||||
|
||||
### `tick(x, cb)`
|
||||
|
||||
* `x` [<number>][] Number of event loop "ticks".
|
||||
* `cb` [<Function>][] A callback function.
|
||||
* `x` [\<number>][] Number of event loop "ticks".
|
||||
* `cb` [\<Function>][] A callback function.
|
||||
|
||||
## tmpdir Module
|
||||
|
||||
@@ -953,7 +966,7 @@ The `tmpdir` module supports the use of a temporary directory for testing.
|
||||
|
||||
### `path`
|
||||
|
||||
* [<string>][]
|
||||
* [\<string>][]
|
||||
|
||||
The realpath of the testing temporary directory.
|
||||
|
||||
@@ -1002,18 +1015,18 @@ A driver class for running WPT with the WPT harness in a worker thread.
|
||||
|
||||
See [the WPT tests README][] for details.
|
||||
|
||||
[<Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
[<ArrayBufferView>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView
|
||||
[<Buffer>]: https://nodejs.org/api/buffer.html#buffer_class_buffer
|
||||
[<BufferSource>]: https://developer.mozilla.org/en-US/docs/Web/API/BufferSource
|
||||
[<Error>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
[<Function>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
|
||||
[<Object>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
[<RegExp>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
||||
[<bigint>]: https://github.com/tc39/proposal-bigint
|
||||
[<boolean>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type
|
||||
[<number>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
|
||||
[<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
|
||||
[\<ArrayBufferView>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView
|
||||
[\<Buffer>]: https://nodejs.org/api/buffer.html#buffer_class_buffer
|
||||
[\<BufferSource>]: https://developer.mozilla.org/en-US/docs/Web/API/BufferSource
|
||||
[\<Error>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
[\<Function>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
|
||||
[\<Object>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
[\<RegExp>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
||||
[\<bigint>]: https://github.com/tc39/proposal-bigint
|
||||
[\<boolean>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type
|
||||
[\<number>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
|
||||
[\<string>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type
|
||||
[Web Platform Tests]: https://github.com/web-platform-tests/wpt
|
||||
[`hijackstdio.hijackStdErr()`]: #hijackstderrlistener
|
||||
[`hijackstdio.hijackStdOut()`]: #hijackstdoutlistener
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
Compile with clang and `wasm32-wasi` target. The clang version used must be
|
||||
built with wasi-libc. You can specify the location for clang and the sysroot
|
||||
if needed when running make:
|
||||
|
||||
```console
|
||||
$ make CC=/usr/local/opt/llvm/bin/clang SYSROOT=/path/to/wasi-libc/sysroot
|
||||
```
|
||||
@@ -15,6 +15,7 @@ WPT harness and have automatic updates. There are also a few
|
||||
This folder covers the tests that have been migrated.
|
||||
|
||||
<a id="add-tests"></a>
|
||||
|
||||
## How to add tests for a new module
|
||||
|
||||
### 1. Create a status file
|
||||
@@ -142,6 +143,7 @@ skipping tests that cannot be run because of lack of dependency or
|
||||
expected failures.
|
||||
|
||||
<a id="status-format"></a>
|
||||
|
||||
## Format of a status JSON file
|
||||
|
||||
```text
|
||||
|
||||
Reference in new issue
Block a user