-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: use strict mode in global setters test #56742
Conversation
test-global-setters.js was added in nodejs#26882 and hasn't been modified since. It appears that it avoids strict mode so that unscoped identifiers are treated as globals, but that's true in strict mode too. (In sloppy mode, an assignment to an undefined identifier will create a global, but that's not what this test does. In strict mode, those assignments will throw an error, which would seem to be what we would want.)
Pinging author-of-the-test @guybedford for review in case there's something I'm misunderstanding. I'll also add |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56742 +/- ##
==========================================
- Coverage 89.21% 89.21% -0.01%
==========================================
Files 662 662
Lines 191968 191976 +8
Branches 36955 36953 -2
==========================================
- Hits 171269 171263 -6
- Misses 13535 13555 +20
+ Partials 7164 7158 -6 |
Commit Queue failed- Loading data for nodejs/node/pull/56742 ✔ Done loading data for nodejs/node/pull/56742 ----------------------------------- PR info ------------------------------------ Title test: use strict mode in global setters test (#56742) Author Rich Trott <rtrott@gmail.com> (@Trott) Branch Trott:strict -> nodejs:main Labels test, author ready, needs-ci, commit-queue-squash Commits 2 - test: use strict mode in global setters test - squash! test: use strict mode in global setters test Committers 1 - Rich Trott <rtrott@gmail.com> PR-URL: https://github.com/nodejs/node/pull/56742 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/56742 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - squash! test: use strict mode in global setters test ℹ This PR was created on Fri, 24 Jan 2025 14:45:39 GMT ✔ Approvals: 2 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/56742#pullrequestreview-2573031130 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/56742#pullrequestreview-2573037493 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-01-24T17:42:01Z: https://ci.nodejs.org/job/node-test-pull-request/64722/ - Querying data for job/node-test-pull-request/64722/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/12975708665 |
// When setters and getters were added for global.process and global.Buffer to | ||
// create a deprecation path for them in ESM, this test was added to make sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be worth noting at this point it's no longer about creating a deprecation path since that ship has likely sailed short of a very big breaking change, but that these getters and setters may be used to attenuate access if we gain the ability to gate the global object by module accessor in future somehow.
Landed in 1263efd |
test-global-setters.js was added in
#26882 and hasn't been modified since. It appears that it avoids strict mode so that unscoped identifiers are treated as globals, but that's true in strict mode too. (In sloppy mode, an assignment to an undefined identifier will create a global, but that's not what this test does. In strict mode, those assignments will throw an error, which would seem to be what we would want.)