Skip to content

Commit

Permalink
test: use strict mode in global setters test
Browse files Browse the repository at this point in the history
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.)

PR-URL: nodejs#56742
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
  • Loading branch information
Trott authored Jan 27, 2025
1 parent 0aa5874 commit 1263efd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/parallel/test-global-setters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/* eslint-disable strict */
// 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
// the setters and getters behaved as expected.
// Ref: https://github.com/nodejs/node/pull/26882
// Ref: https://github.com/nodejs/node/pull/26334

'use strict';
require('../common');
const assert = require('assert');
const _process = require('process');
Expand Down

0 comments on commit 1263efd

Please sign in to comment.