Uh oh!
There was an error while loading. Please reload this page.
test: compute list of expected globals from ESLint config file - #42056
test: compute list of expected globals from ESLint config file#42056aduh95 wants to merge 15 commits into
Conversation
| atob, | ||
| btoa | ||
| } = require('buffer'); | ||
| const parseEslintConfigForGlobals = require('./parseEslintConfigForGlobals'); |
There was a problem hiding this comment.
Does this need to be a separate file? Should it be inlined so that people don't think it's something they can/should include themselves in their own tests?
RaisinTen
left a comment
There was a problem hiding this comment.
We need to synchronously read and parse lib/.eslintrc.yaml line-by-line for this to work correctly.
Uh oh!
There was an error while loading. Please reload this page.
b3964c2 to
d6e4f2dCompared6e4f2d to
96115e9Comparenodejs-github-bot
commented
Feb 22, 2022
96115e9 to
9a5ec5fComparenodejs-github-bot
commented
Feb 26, 2022
nodejs-github-bot
commented
Feb 26, 2022
| .PHONY: jstest | ||
| jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests | ||
| jstest: build-addons build-js-native-api-tests build-node-api-tests test/common/knownGlobals.json ## Runs addon tests and JS tests |
| ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).pkg.done" | ||
| $(TARBALL): release-only doc-only | ||
| $(TARBALL): release-only doc-only test/common/knownGlobals.json |
There was a problem hiding this comment.
This target will also probably need to copy in the generated test/common/knownGlobals.json as the tarball is prepared in $(TARNAME)/ from a fresh git checkout-index.
nodejs-github-bot
commented
Feb 27, 2022
nodejs-github-bot
commented
Feb 27, 2022
nodejs-github-bot
commented
Feb 27, 2022
nodejs-github-bot
commented
Mar 1, 2022
aduh95
commented
Mar 2, 2022
Blocked on nodejs/build#2879 |
targos
commented
Mar 2, 2022
What's the reason for using Python to generate the file? |
aduh95
commented
Mar 2, 2022
Because the tarball action doesn't have any available |
targos
commented
Mar 2, 2022
Don't GitHub runners all have |
aduh95
commented
Mar 2, 2022
Maybe it was too old to work? I don't exactly remember tbh. Using Python as also the upside of being already integrated in the test suite. Is there a reason not to use Python? |
targos
commented
Mar 2, 2022
I hope that one day, Python won't be required anymore to work on node, so adding things that rely on it doesn't help. |
aduh95
commented
Mar 2, 2022
OK gotcha! Hopefully this won't be too much of a burden to port this to whatever replacement we find – it could be a sed script if it wasn't for Windows support. |
| const tmpdir = require('../common/tmpdir'); | ||
| tmpdir.refresh(); | ||
| common.allowGlobals('require', '_', '_error', ...require('module').builtinModules); |
There was a problem hiding this comment.
Maybe add common.allowReplGlobals() or similar to avoid repetition?
targos
commented
Mar 2, 2022
I'm ok with the bullet points in your OP, and the changes to |
RaisinTen
commented
Mar 2, 2022
If we avoid Python and generate the JSON in JS, it would be convenient to do it without creating any additional files which would address #42056 (comment) but I don't know how much time it would add overall when we run all the tests. |
This pull request has been marked as stale due to 90 days of inactivity. |
We don't want to rely on mutable globals for core modules. Instead of
maintaining a separate list of known globals in our test files, parse
the ESLint config to ensure all globals are restricted in the
lib/directory.
fetch). It also solves the case where there are two global variables referencing the same object (e.g.globalandglobalThis).@targos This may have consequences for V8 updates (if the new V8 version ships with new globals).
/cc @benjamingr
Blocked on
#42049nodejs/build#2879.