Uh oh!
There was an error while loading. Please reload this page.
doc,test: test documentation consistency for NODE_OPTIONS - #28179
doc,test: test documentation consistency for NODE_OPTIONS#28179richardlau wants to merge 2 commits into
Conversation
richardlau
commented
Jun 11, 2019
This is a draft/wip because it currently (legitimately) fails: -bash-4.2$ ./node test/parallel/test-process-env-allowed-flags-are-documented.jsassert.js:89 throw new AssertionError(obj); ^AssertionError [ERR_ASSERTION]: The following options are not documented as allowed in NODE_OPTIONS in /home/users/riclau/sandbox/github/nodejs/doc/api/cli.md: --tls-min-v1.2 --input-type --experimental-worker --tls-min-v1.3 --debug-arraybuffer-allocations --tls-max-v1.2 --experimental-policy --preserve-symlinks --http-parser --tls-min-v1.0 --es-module-specifier-resolution --preserve-symlinks-main --tls-max-v1.3 --tls-min-v1.1 --prof-process -r --debug-port at Object.<anonymous> (/home/users/riclau/sandbox/github/nodejs/test/parallel/test-process-env-allowed-flags-are-documented.js:35:8) at Module._compile (internal/modules/cjs/loader.js:777:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10) at Module.load (internal/modules/cjs/loader.js:640:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:840:10) at internal/main/run_main_module.js:17:11 { generatedMessage: false, code: 'ERR_ASSERTION', actual: 17, expected: 0, operator: 'strictEqual'}-bash-4.2$#28146 will fix the missing tls options. I'll add the other missing entries to the docs. If anyone sees anything in this list that shouldn't be there please say so. |
This comment has been minimized.
This comment has been minimized.
e9202ca to
5557153CompareUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
This seems brittle. A line-wrap change could break it. And I'll definitely break it when I inevitably decide to reduce passive voice from the doc. But I don't have a better idea, so...¯\(ツ)/¯ (FWIW, I'd prefer if the doc said something like "Valid options are:". But obviously that can and likely should be some other PR some time.)
There was a problem hiding this comment.
FWIW if we change the line in doc/api/cli.md to Valid options are: the test fails:
-bash-4.2$ ./node test/parallel/test-process-env-allowed-flags-are-documented.js/home/users/riclau/sandbox/github/nodejs/test/parallel/test-process-env-allowed-flags-are-documented.js:17const docOptions = cliDocs.match(docRegExp)[0]; ^TypeError: Cannot read property '0' of null at Object.<anonymous> (/home/users/riclau/sandbox/github/nodejs/test/parallel/test-process-env-allowed-flags-are-documented.js:17:44) at Module._compile (internal/modules/cjs/loader.js:779:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:790:10) at Module.load (internal/modules/cjs/loader.js:642:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:842:10) at internal/main/run_main_module.js:17:11-bash-4.2$I'll see what we can do to make this better.
There was a problem hiding this comment.
@Trott Changed this so that it now starts at the section header, which is less likely to change. PTAL.
(Test now still works when the prose is changed to "Valid options are:" but I'll let you make that change.)
There was a problem hiding this comment.
Since HTML comments are valid Markdown, maybe we can delineate the list with a self-documenting HTML comment and use a RegExp to search for that? A suggestion, but totally not blocking this.
There was a problem hiding this comment.
Added HTML comment markers. PTAL.
Of course now we have markers the follow on step would be to automatically update the list (since Node.js know which options are allowed in the environment and we've marked in the document where the lists should go). I'd prefer that to be a follow on PR 😁.
5557153 to
8917655CompareUh oh!
There was an error while loading. Please reload this page.
8917655 to
7b41260CompareBridgeAR
commented
Jun 12, 2019
One more thought: we might also validate the correct documentation order. |
This comment has been minimized.
This comment has been minimized.
Add missing options to the list of allowed options for the `NODE_OPTIONS` environment variable. Sort the list alphabetically.
Add a test that checks that the documented allowed options for the `NODE_OPTIONS` environment variable are consistent with the actually allowed options.
7b41260 to
6bfc840Comparerichardlau
commented
Jun 13, 2019
@BridgeAR After changing the test and documentation to use markers to denote where to parse the options from the documentation this ended up being much easier so I've updated the test to check the options are alphabetically sorted. |
richardlau
commented
Jun 14, 2019
jasnell
commented
Jun 14, 2019
A lint rule might be better? |
richardlau
commented
Jun 14, 2019
The node binary running the linter may not be the same as the one corresponding to the source tree. However I won't stand in the way if anyone else wants to attempt this as a lint rule. |
Trott
commented
Jun 15, 2019
Landed in 3cdd5a2...5225586 |
Add missing options to the list of allowed options for the `NODE_OPTIONS` environment variable. Sort the list alphabetically. PR-URL: nodejs#28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add a test that checks that the documented allowed options for the `NODE_OPTIONS` environment variable are consistent with the actually allowed options. PR-URL: nodejs#28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add missing options to the list of allowed options for the `NODE_OPTIONS` environment variable. Sort the list alphabetically. PR-URL: #28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add a test that checks that the documented allowed options for the `NODE_OPTIONS` environment variable are consistent with the actually allowed options. PR-URL: #28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add missing options to the list of allowed options for the `NODE_OPTIONS` environment variable. Sort the list alphabetically. PR-URL: #28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add a test that checks that the documented allowed options for the `NODE_OPTIONS` environment variable are consistent with the actually allowed options. PR-URL: #28179 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
doc: add missing options allowed in NODE_OPTIONS
Add missing options to the list of allowed options for the
NODE_OPTIONSenvironment variable. Sort the list alphabetically.doc,test: test documentation consistency for NODE_OPTIONS
Add a test that checks that the documented allowed options for the
NODE_OPTIONSenvironment variable are consistent with the actuallyallowed options.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes