Skip to content
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

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

Trott
Copy link
Member

@Trott Trott commented Jan 24, 2025

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.)

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.)
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jan 24, 2025
@Trott
Copy link
Member Author

Trott commented Jan 24, 2025

Pinging author-of-the-test @guybedford for review in case there's something I'm misunderstanding.

I'll also add request-ci in case the reason for avoiding strict mode becomes evident by a test failure in a particular environment.

@Trott Trott requested a review from guybedford January 24, 2025 14:48
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 24, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 24, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.21%. Comparing base (08eeddf) to head (513d880).
Report is 33 commits behind head on main.

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     

see 28 files with indirect coverage changes

@Trott Trott added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 24, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 24, 2025
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 25, 2025
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 26, 2025
@nodejs-github-bot
Copy link
Collaborator

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/.ncu
https://github.com/nodejs/node/actions/runs/12975708665

Comment on lines +1 to +2
// 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
Copy link
Contributor

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.

@Trott Trott added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 26, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 27, 2025
@nodejs-github-bot nodejs-github-bot merged commit 1263efd into nodejs:main Jan 27, 2025
73 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 1263efd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants