Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix nits in common/README #17971

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 54 additions & 79 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This directory contains modules used to test the Node.js implementation.
* [DNS module](#dns-module)
* [Duplex pair helper](#duplex-pair-helper)
* [Fixtures module](#fixtures-module)
* [HTTP2 module](#http2-module)
* [Internet module](#internet-module)
* [WPT module](#wpt-module)
* [HTTP2 module](#http2-module)

## Benchmark Module

Expand Down Expand Up @@ -509,58 +509,12 @@ Returns the result of
Returns the result of
`fs.readFileSync(path.join(fixtures.fixturesDir, 'keys', arg), 'enc')`.

## Internet Module

The `common/internet` module provides utilities for working with
internet-related tests.

### internet.addresses

* [<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
Google Public DNS IPv4 address
* `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

A set of addresses for internet-related tests. All properties are configurable
via `NODE_TEST_*` environment variables. For example, to configure
`internet.addresses.INET_HOST`, set the environment
vairable `NODE_TEST_INET_HOST` to a specified host.

## WPT Module

The wpt.js module is a port of parts of
[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the
Node.js
[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api)
implementation with tests from
[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests).

## HTTP/2 Module

The http2.js module provides a handful of utilities for creating mock HTTP/2
frames for testing of HTTP/2 endpoints

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const http2 = require('../common/http2');
```
Expand All @@ -570,10 +524,7 @@ const http2 = require('../common/http2');
The `http2.Frame` is a base class that creates a `Buffer` containing a
serialized HTTP/2 frame header.

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// length is a 24-bit unsigned integer
// type is an 8-bit unsigned integer identifying the frame type
Expand All @@ -592,17 +543,14 @@ The serialized `Buffer` may be retrieved using the `frame.data` property.
The `http2.DataFrame` is a subclass of `http2.Frame` that serializes a `DATA`
frame.

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// id is the 32-bit stream identifier
// payload is a Buffer containing the DATA payload
// padlen is an 8-bit integer giving the number of padding bytes to include
// final is a boolean indicating whether the End-of-stream flag should be set,
// defaults to false.
const data = new http2.DataFrame(id, payload, padlen, final);
const frame = new http2.DataFrame(id, payload, padlen, final);

socket.write(frame.data);
```
Expand All @@ -612,19 +560,15 @@ socket.write(frame.data);
The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a
`HEADERS` frame.

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// id is the 32-bit stream identifier
// payload is a Buffer containing the HEADERS payload (see either
// http2.kFakeRequestHeaders or http2.kFakeResponseHeaders).
// padlen is an 8-bit integer giving the number of padding bytes to include
// final is a boolean indicating whether the End-of-stream flag should be set,
// defaults to false.
const data = new http2.HeadersFrame(id, http2.kFakeRequestHeaders,
padlen, final);
const frame = new http2.HeadersFrame(id, payload, padlen, final);

socket.write(frame.data);
```
Expand All @@ -634,10 +578,7 @@ socket.write(frame.data);
The `http2.SettingsFrame` is a subclass of `http2.Frame` that serializes an
empty `SETTINGS` frame.

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// ack is a boolean indicating whether or not to set the ACK flag.
const frame = new http2.SettingsFrame(ack);
Expand All @@ -650,10 +591,7 @@ socket.write(frame.data);
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 strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const frame = new http2.HeadersFrame(1, http2.kFakeRequestHeaders, 0, true);

Expand All @@ -665,10 +603,7 @@ socket.write(frame.data);
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 strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const frame = new http2.HeadersFrame(1, http2.kFakeResponseHeaders, 0, true);

Expand All @@ -680,14 +615,54 @@ socket.write(frame.data);
Set to a `Buffer` containing the preamble bytes an HTTP/2 client must send
upon initial establishment of a connection.

<!-- eslint-disable strict -->
<!-- eslint-disable required-modules -->
<!-- eslint-disable no-unused-vars -->
<!-- eslint-disable no-undef -->
<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
socket.write(http2.kClientMagic);
```

## Internet Module

The `common/internet` module provides utilities for working with
internet-related tests.

### internet.addresses

* [&lt;Object>]
* `INET_HOST` [&lt;String>] A generic host that has registered common
DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS
services
* `INET4_HOST` [&lt;String>] A host that provides IPv4 services
* `INET6_HOST` [&lt;String>] A host that provides IPv6 services
* `INET4_IP` [&lt;String>] An accessible IPv4 IP, defaults to the
Google Public DNS IPv4 address
* `INET6_IP` [&lt;String>] An accessible IPv6 IP, defaults to the
Google Public DNS IPv6 address
* `INVALID_HOST` [&lt;String>] An invalid host that cannot be resolved
* `MX_HOST` [&lt;String>] A host with MX records registered
* `SRV_HOST` [&lt;String>] A host with SRV records registered
* `PTR_HOST` [&lt;String>] A host with PTR records registered
* `NAPTR_HOST` [&lt;String>] A host with NAPTR records registered
* `SOA_HOST` [&lt;String>] A host with SOA records registered
* `CNAME_HOST` [&lt;String>] A host with CNAME records registered
* `NS_HOST` [&lt;String>] A host with NS records registered
* `TXT_HOST` [&lt;String>] A host with TXT records registered
* `DNS4_SERVER` [&lt;String>] An accessible IPv4 DNS server
* `DNS6_SERVER` [&lt;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
`internet.addresses.INET_HOST`, set the environment
vairable `NODE_TEST_INET_HOST` to a specified host.

## WPT Module

The wpt.js module is a port of parts of
[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the
Node.js
[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api)
implementation with tests from
[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests).


[&lt;Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
[&lt;ArrayBufferView&#91;&#93;>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView
Expand Down