Uh oh!
There was an error while loading. Please reload this page.
tools: add eslint rule for hasCrypto checking - #13813
Conversation
danbev
commented
Jun 20, 2017
refack
commented
Jun 20, 2017
I love the idea! |
cjihrig
commented
Jun 20, 2017
Seems like a good idea to me. Is it possible to tighten up the check though? For example, could it only check |
There was a problem hiding this comment.
No reason, let me fix that too. Thanks!
There was a problem hiding this comment.
Can't believe I missed that, will fix.
gibfahn
commented
Jun 20, 2017
danbev
commented
Jun 20, 2017
I can't take credit for the idea as it was @gibfahn's |
danbev
commented
Jun 20, 2017
I'll take a look, but one issue is that there are places in tests where the check is not used to skip the test but instead only run part of a test, for example in test-async-wrap-getasyncid.js. |
cjihrig
commented
Jun 20, 2017
If those cases are the exception, we could disable the rule for a line. Or, if it makes sense, refactor the test(s). |
There was a problem hiding this comment.
Nitpick: It seems like this function closes over context anyway, so I don't think the context parameter here is needed.
There was a problem hiding this comment.
Good point, I'll fix that. Thanks
danbev
commented
Jun 21, 2017
I'll take a closer look at the usages of it and see if it makes sense to disable or refactor. Thanks |
aae61ff to
7e03560Comparedanbev
commented
Jun 27, 2017
Rebased and refactored CI: https://ci.nodejs.org/job/node-test-pull-request/8843/ |
danbev
commented
Jun 27, 2017
test/windows-fanned failure looks unrelatedgyp: c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2\common.gypi not found (cwd: c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2\test\addons\06_passing_wrapped_objects_around) while reading includes of binding.gyp while trying to load binding.gypgyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1gyp ERR! stack at ChildProcess.onCpExit (c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2\deps\npm\node_modules\node-gyp\lib\configure.js:336:16)gyp ERR! stack at emitTwo (events.js:125:13)gyp ERR! stack at ChildProcess.emit (events.js:213:7)gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)gyp ERR! System Windows_NT 6.1.7601gyp ERR! command "c:\\workspace\\node-test-binary-windows\\RUN_SUBSET\\2\\VS_VERSION\\vs2015-x86\\label\\win2008r2\\Release\\node.exe" "c:\\workspace\\node-test-binary-windows\\RUN_SUBSET\\2\\VS_VERSION\\vs2015-x86\\label\\win2008r2\\deps\\npm\\node_modules\\node-gyp\\bin\\node-gyp" "rebuild" "--directory=test\\addons\\06_passing_wrapped_objects_around" "--nodedir=c:\\workspace\\node-test-binary-windows\\RUN_SUBSET\\2\\VS_VERSION\\vs2015-x86\\label\\win2008r2"gyp ERR! cwd c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2\test\addons\06_passing_wrapped_objects_aroundgyp ERR! node -v v9.0.0-pregyp ERR! node-gyp -v v3.6.2gyp ERR! not ok c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>TASKKILL /F /IM node.exe /T || TRUEERROR: The process "node.exe" not found.c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>TASKKILL /F /IM cctest.exe /T || TRUEERROR: The process "cctest.exe" not found.c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>TASKKILL /F /IM run-tests.exe /T || TRUEERROR: The process "run-tests.exe" not found.c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>TASKKILL /F /IM yes.exe /T || TRUEERROR: The process "yes.exe" not found.c:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>rm -rfv test/tmp* || truec:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>rm -vf ../test.tap || truec:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>mv test.tap ../test.tap || truemv: cannot stat 'test.tap': No such file or directoryc:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>git clean -fdx || truefatal: Not a git repository (or any of the parent directories): .gitc:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>git reset --hard || truefatal: Not a git repository (or any of the parent directories): .gitc:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>mv ../test.tap test.tap || truemv: cannot stat '../test.tap': No such file or directoryc:\workspace\node-test-binary-windows\RUN_SUBSET\2\VS_VERSION\vs2015-x86\label\win2008r2>exit /b 1 Build step 'Execute Windows batch command' marked build as failureTAP Reports Processing: STARTLooking for TAP results report in workspace using pattern: test.tapDid not find any matching files. Setting build result to FAILURE.Checking ^not okJenkins Text Finder: File set 'test.tap' is emptyNotifying upstream projects of job completionFinished: FAILURE |
danbev
commented
Jun 27, 2017
@cjihrig I've updated this now with your suggestions. Would you be able to take a look and see if this is what you had in mind? |
cjihrig
commented
Jun 27, 2017
This is getting closer. Ideally, I was hoping to have a single rule that could be parameterized, and it seems like you're really close there. I'm also curious why a test like |
danbev
commented
Jun 28, 2017
Ah good point, let me double check that. |
7e03560 to
d48b968Comparedanbev
commented
Jun 28, 2017
I'll take another look. I see some similarity between the inspector and crypto rule but not enough to be parameterized fully. For crypto we can check and verify that we are doing it in an if statement and that it contains a skip as you suggested. But for inspector this would simply be a call to |
d48b968 to
c12d6d4Comparerefack
commented
Jul 2, 2017
After reviewing #14021 I saw there is allot of |
danbev
commented
Jul 2, 2017
There are a few cases where requiring crypto but not skipping the whole test might be appropriate. One example is a test that checks command line options and I think it makes sense for it to skip only the crypto related options and test the others. |
refack
commented
Jul 2, 2017
So we could have an equivalent to |
215d463 to
3c2db1aComparedanbev
commented
Jul 6, 2017
danbev
commented
Jul 6, 2017
test/freebsd failure looks unrelatednot ok 680 parallel/test-http-server-keep-alive-timeout-slow-client-headers --- duration_ms: 1.464 severity: fail stack: |- events.js:182 throw er; // Unhandled 'error' event ^ Error: This socket has been ended by the other party at Socket.writeAfterFIN [as write] (net.js:356:12) at Timeout.setTimeout [as _onTimeout] (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/parallel/test-http-server-keep-alive-timeout-slow-client-headers.js:39:14) at ontimeout (timers.js:488:11) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:283:5) |
3c2db1a to
733e3d8Comparedanbev
commented
Aug 8, 2017
CI: https://ci.nodejs.org/job/node-test-pull-request/9542/ (expecting the linter to fail) |
733e3d8 to
66a5501Comparedanbev
commented
Aug 16, 2017
The motivation for this commit is to pick up early on missing checks for crypto support (when Node is built --without-ssl).
There are currently usages of common.hasCrypto which are not just for detecting if crypto support is available and then skip the test in question. For these case we still want to have a lint error generated which can then be disabled using an ESLint comment.
The motivation for this commit is to pick up early on missing checks for inspector support (when Node is built --without-inspector).
66a5501 to
11dc3d0CompareBridgeAR
commented
Aug 30, 2017
Could @jasnell and @not-an-aardvark approve again? I think this could land right after. |
jasnell
commented
Aug 30, 2017
Still LGTM but a fresh CI before landing would be appreciated |
not-an-aardvark
commented
Aug 30, 2017
LGTM |
BridgeAR
commented
Aug 30, 2017
BridgeAR
commented
Aug 30, 2017
The motivation for this commit is to pick up early on missing checks for crypto support (when Node is built --without-ssl). There are currently usages of common.hasCrypto which are not just for detecting if crypto support is available and then skip the test in question. For these case we still want to have a lint error generated which can then be disabled using an ESLint comment. PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for inspector support (when Node is built --without-inspector). PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
danbev
commented
Aug 31, 2017
Thanks everyone! |
The motivation for this commit is to pick up early on missing checks for crypto support (when Node is built --without-ssl). There are currently usages of common.hasCrypto which are not just for detecting if crypto support is available and then skip the test in question. For these case we still want to have a lint error generated which can then be disabled using an ESLint comment. PR-URL: nodejs/node#13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for inspector support (when Node is built --without-inspector). PR-URL: nodejs/node#13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for crypto support (when Node is built --without-ssl). There are currently usages of common.hasCrypto which are not just for detecting if crypto support is available and then skip the test in question. For these case we still want to have a lint error generated which can then be disabled using an ESLint comment. PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for inspector support (when Node is built --without-inspector). PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for crypto support (when Node is built --without-ssl). There are currently usages of common.hasCrypto which are not just for detecting if crypto support is available and then skip the test in question. For these case we still want to have a lint error generated which can then be disabled using an ESLint comment. PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
The motivation for this commit is to pick up early on missing checks for inspector support (when Node is built --without-inspector). PR-URL: #13813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
MylesBorins
commented
Sep 20, 2017
Should this be backported to |
The motivation for this commit is to pick up early on missing checks for
crypto support (when Node is built --without-ssl).
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
tools