| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
typo: skippped?
Sorry, something went wrong.
There was a problem hiding this comment.
I based this on the equivalent inspector-check and didn't notice it was wrong there. I'll correct both.
Sorry, something went wrong.
|
Fun. So we have a failing eslint rule test, e.g., https://ci.nodejs.org/job/node-test-commit-plinux/nodes=ppcle-ubuntu1404/17266/console not ok 448 parallel/test-eslint-require-buffer
---
duration_ms: 2.34
severity: fail
exitcode: 1
stack: |-
/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:148
throw err;
^
AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
+ expected - actual
- 'Use const { Buffer } = require(\'buffer\'); at the beginning of this file'
+ 'Use const Buffer = require(\'buffer\').Buffer; at the beginning of this file' ('Use const { Buffer } = require(\'buffer\'); at the beginning of this file' strictEqual 'Use const Buffer = require(\'buffer\').Buffer; at the beginning of this file')
at assertMessageMatches (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:442:24)
at testInvalidTemplate (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:494:29)
at Function.RuleTester.it (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:581:25)
at Function.itDefaultHandler (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:143:23)
at test.invalid.forEach.invalid (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:580:32)
at Array.forEach (<anonymous>)
at Function.RuleTester.describe (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:579:30)
at Function.describeDefaultHandler (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:160:19)
at Function.RuleTester.describe (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:578:24)
at Function.describeDefaultHandler (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/tools/node_modules/eslint/lib/testers/rule-tester.js:160:19)
...
This PR doesn't touch that test, nor the eslint check that it exercises but it does fix common.skipIfEslintMissing() so this test probably failed before but was being skipped over as eslint wasn't detected 😱. |
Sorry, something went wrong.
|
#19701 changed the message but not the corresponding test. |
Sorry, something went wrong.
|
Fixed up the test-eslint-require-buffer test. Aborted the failing in progress CI and rebuilding: https://ci.nodejs.org/job/node-test-pull-request/14555/ |
Sorry, something went wrong.
|
We have a chicken-egg problem. The CI machines don't install eslint, so these tests are never run. On the other hand this is meta-meta-meta-testing (writing a test to verify a test to the linter is properly skipped 😵) and might be overkill? Why not just move the test-eslint-* files to their own suite and only run that in special circumstancess (maybe only on the linter CI) |
Sorry, something went wrong.
The CI machines don't need to install eslint as it's already in the source tree from a git checkout. It's only when building from the source tarball that eslint is missing. The tests weren't being run because the common.skipIfEslintMissing check was looking in the wrong place. |
Sorry, something went wrong.
I'm not opposed to this idea (if someone else does the work* 😛) since these tests are testing our custom eslint rules and not testing Node.js itself. * It's now 10pm here -- I started working on this three hours ago thinking this would be a quick fix (inserting the missing common.skipIfEslintMissing calls) then thought I'd implement a custom eslint rule to catch regressions. Then spent an hour trying to work out why the new rule test didn't fail (hint you need to clear the eslint cache before any new rules are picked up). And then the test-eslint-require-buffer failure. |
Sorry, something went wrong.
Ohh right. So it makes me think about wrong assumptions... the skip rule should look for positive indicator (e.g. existence of .git directory) instead of a negative indicator, so that if things change it'll detect it and not silintly skip (i.e. fail) |
Sorry, something went wrong.
I'll see what I can come up with... |
Sorry, something went wrong.
It checks for the presence of the eslint directory: Lines 495 to 501 in a4b4854 (Note that at the moment it's looking in a relative directory and hence incorrect (fixed as part of this PR)). |
Sorry, something went wrong.
|
The rule is skip if !exist that's a double negative, not a positive Line 496 in a4b4854 So it's error prone — if path calculation is wrong, skip. If we tree-factor and moved the dir (again), skip. If we finish rolling-up eslint into a single file, skip 🤷♂️ . |
Sorry, something went wrong.
|
cc @nodejs/linting |
Sorry, something went wrong.
|
arm CI rerun passes: https://ci.nodejs.org/job/node-test-commit-arm-fanned/829/ |
Sorry, something went wrong.
|
I didn't label this author-ready due to concerns raised by @refack. While I agree that the skipIfEslintMissing check is fragile if the eslint directory changes, this PR is no less fragile than before and would actually fix the rules tests so that they are run on the CI plus improve the situation for Debian (#20336) and anyone else building from the source tarball. I'm on a tablet at the moment so can't land this right now, but unless there are actual objections I'll land early next week (unless someone else lands first). |
Sorry, something went wrong.
Add a custom eslint rule to check for `common.skipIfEslintMissing()` to allow tests to run from source tarballs that do not include eslint. Fix up rule tests that were failing the new check. Refs: nodejs#20336 PR-URL: nodejs#20372 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Add a custom eslint rule to check for `common.skipIfEslintMissing()` to allow tests to run from source tarballs that do not include eslint. Fix up rule tests that were failing the new check. Refs: #20336 PR-URL: #20372 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Add a custom eslint rule to check for `common.skipIfEslintMissing()` to allow tests to run from source tarballs that do not include eslint. Fix up rule tests that were failing the new check. Refs: #20336 PR-URL: #20372 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Add a custom eslint rule to check for `common.skipIfEslintMissing()` to allow tests to run from source tarballs that do not include eslint. Fix up rule tests that were failing the new check. Refs: #20336 PR-URL: #20372 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Add a custom eslint rule to check for common.skipIfEslintMissing() to
allow tests to run from source tarballs that do not include eslint.
Fix up tests that were failing the new check.
Refs: #20336 (comment)
Checklist