From 3251cefb4511bc5cc18951ddd72694d6369b28c6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Aug 2018 15:03:18 -0700 Subject: [PATCH 1/5] fix lint error in test fixtures Add first-level header to .md file in fixture directory. The file in question is documentation for the fixture and is not part of any tests. This is in prepration for markdown linting of the `test` directory. --- test/fixtures/0-dns/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/fixtures/0-dns/README.md b/test/fixtures/0-dns/README.md index 650970a2c5a5cf..9a4a4a2b3d8a93 100644 --- a/test/fixtures/0-dns/README.md +++ b/test/fixtures/0-dns/README.md @@ -1,3 +1,5 @@ +# 0-dns + ## Purpose The test cert file for use `test/parallel/test-tls-0-dns-altname.js` can be created by using `asn1.js` and `asn1.js-rfc5280`, From 858f7915bd5c7cb6c4f085425fc51c8d722a8f92 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Aug 2018 15:10:47 -0700 Subject: [PATCH 2/5] test,doc: wrap common module md doc at 80 chars In preparation for markdown linting of files in the `test` directory, make sure all lines in `test/common/README.md` are no more than 80 characters long. --- test/common/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index af66d898c1ba75..27634c97e11e17 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -572,7 +572,7 @@ one listed below. (`heap.validateSnapshotNodes(...)` is a shortcut for Create a heap dump and an embedder graph copy and validate occurrences. - + ```js validateSnapshotNodes('TLSWRAP', [ { @@ -590,7 +590,7 @@ validateSnapshotNodes('TLSWRAP', [ The http2.js module provides a handful of utilities for creating mock HTTP/2 frames for testing of HTTP/2 endpoints - + ```js const http2 = require('../common/http2'); ``` @@ -600,7 +600,7 @@ const http2 = require('../common/http2'); The `http2.Frame` is a base class that creates a `Buffer` containing a serialized HTTP/2 frame header. - + ```js // length is a 24-bit unsigned integer // type is an 8-bit unsigned integer identifying the frame type @@ -619,7 +619,7 @@ 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. - + ```js // id is the 32-bit stream identifier // payload is a Buffer containing the DATA payload @@ -636,7 +636,7 @@ socket.write(frame.data); The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a `HEADERS` frame. - + ```js // id is the 32-bit stream identifier // payload is a Buffer containing the HEADERS payload (see either @@ -654,7 +654,7 @@ socket.write(frame.data); The `http2.SettingsFrame` is a subclass of `http2.Frame` that serializes an empty `SETTINGS` frame. - + ```js // ack is a boolean indicating whether or not to set the ACK flag. const frame = new http2.SettingsFrame(ack); @@ -667,7 +667,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`. - + ```js const frame = new http2.HeadersFrame(1, http2.kFakeRequestHeaders, 0, true); @@ -679,7 +679,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`. - + ```js const frame = new http2.HeadersFrame(1, http2.kFakeResponseHeaders, 0, true); @@ -691,7 +691,7 @@ socket.write(frame.data); Set to a `Buffer` containing the preamble bytes an HTTP/2 client must send upon initial establishment of a connection. - + ```js socket.write(http2.kClientMagic); ``` From 81a98f0cb08d8a65e725ebf2efebd3868b120f31 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Aug 2018 15:12:46 -0700 Subject: [PATCH 3/5] test,doc: adjust async-hooks coverage doc for lint First header should be a first-level header according to our lint rules. Make it so in prepartion for applying the markdown linting to the test directory. --- test/async-hooks/coverage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/async-hooks/coverage.md b/test/async-hooks/coverage.md index 4ac7bc24a58bb4..0a2af0d06bfd62 100644 --- a/test/async-hooks/coverage.md +++ b/test/async-hooks/coverage.md @@ -1,4 +1,4 @@ -## AsyncHooks Coverage Overview +# AsyncHooks Coverage Overview Showing which kind of async resource is covered by which test: From 61901d452f4b7f8a9fc7551267ddadfcb6d8a9b9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Aug 2018 15:19:04 -0700 Subject: [PATCH 4/5] test,doc: adjust markdown table for linting In preparation for applying markdown linting to the `test` directory, adjust the table in `test/README.md` to comply with our markdown rules. --- test/README.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/README.md b/test/README.md index 582e5c58367c6f..7ef705230983f3 100644 --- a/test/README.md +++ b/test/README.md @@ -13,25 +13,25 @@ GitHub with the `autocrlf` git config flag set to true. ## Test Directories -|Directory |Runs on CI |Purpose | -|-------------------|---------------|---------------| -|abort |Yes |Tests for when the ``` --abort-on-uncaught-exception ``` flag is used.| -|addons |Yes |Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon to function properly.| -|addons-napi |Yes |Tests for [n-api](https://nodejs.org/api/n-api.html) functionality.| -|async-hooks |Yes |Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality.| -|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.| -|common | |Common modules shared among many tests. [Documentation](./common/README.md)| -|doctool |Yes |Tests for the documentation generator.| -|es-module |Yes |Test ESM module loading.| -|fixtures | |Test fixtures used in various tests throughout the test suite.| -|internet |No |Tests that make real outbound connections (mainly networking related modules). Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections.| -|known_issues |Yes |Tests reproducing known issues within the system. All tests inside of this directory are expected to fail consistently. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`.| -|message |Yes |Tests for messages that are output for various conditions (```console.log```, error messages etc.)| -|parallel |Yes |Various tests that are able to be run in parallel.| -|pseudo-tty |Yes |Tests that require stdin/stdout/stderr to be a TTY.| -|pummel |No |Various tests for various modules / system functionality operating under load.| -|sequential |Yes |Various tests that are run sequentially.| -|testpy | |Test configuration utility used by various test suites.| -|tick-processor |No |Tests for the V8 tick processor integration. The tests are for the logic in ```lib/internal/v8_prof_processor.js``` and ```lib/internal/v8_prof_polyfill.js```. The tests confirm that the profile processor packages the correct set of scripts from V8 and introduces the correct platform specific logic.| -|v8-updates |No |Tests for V8 performance integration.| +| Directory | Runs on CI | Purpose | +| ------------------- | --------------- | --------------- | +| `abort` | Yes | Tests for when the ``` --abort-on-uncaught-exception ``` flag is used. | +| `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon to function properly. | +| `addons-napi` | Yes | Tests for [n-api](https://nodejs.org/api/n-api.html) functionality. | +| `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. | +| `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. | +| `common` | | Common modules shared among many tests. [Documentation](./common/README.md) | +| `doctool` | Yes | Tests for the documentation generator. | +| `es-module` | Yes | Test ESM module loading. | +| `fixtures` | | Test fixtures used in various tests throughout the test suite. | +| `internet` | No | Tests that make real outbound connections (mainly networking related modules). Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections. | +| `known_issues` | Yes | Tests reproducing known issues within the system. All tests inside of this directory are expected to fail consistently. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`. | +| `message` | Yes | Tests for messages that are output for various conditions (```console.log```, error messages etc.) | +| `parallel` | Yes | Various tests that are able to be run in parallel. | +| `pseudo-tty` | Yes | Tests that require stdin/stdout/stderr to be a TTY. | +| `pummel` | No | Various tests for various modules / system functionality operating under load. | +| `sequential` | Yes | Various tests that are run sequentially. | +| `testpy` | | Test configuration utility used by various test suites. | +| `tick-processor` | No | Tests for the V8 tick processor integration. The tests are for the logic in ```lib/internal/v8_prof_processor.js``` and ```lib/internal/v8_prof_polyfill.js```. The tests confirm that the profile processor packages the correct set of scripts from V8 and introduces the correct platform specific logic. | +| `v8-updates` | No | Tests for V8 performance integration. | From 8e5c72750f9cdbf916a7aab598eb8a53e63bd081 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Aug 2018 15:19:40 -0700 Subject: [PATCH 5/5] tools,build: apply markdown linting to test dir Enable markdown linting of the test directory. This change is applied only to Makefile and not vcbuild.bat because we do not currently lint anything outside of the doc directory using vcbuild.bat. In the Makefile, the other targets are called "misc" but that feature does not currently exist in vcbuild.bat. Adding it would be good, but outside the scope of this change. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fc4a094656a452..0d417ef046880c 100644 --- a/Makefile +++ b/Makefile @@ -1081,7 +1081,7 @@ else @echo "Skipping Markdown linter on docs (no crypto)" endif -LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu +LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu LINT_MD_ROOT_DOCS := $(wildcard *.md) LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ -not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS)