From 11b82de7ed9cadd5913ec950d5c78083cceafdd8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 26 Jan 2025 16:02:05 -0800 Subject: [PATCH] test: use strict mode in global setters test test-global-setters.js was added in https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/pull/56742 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Guy Bedford --- test/parallel/test-global-setters.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-global-setters.js b/test/parallel/test-global-setters.js index 7fd070ed8e1c4e..3117118563a78d 100644 --- a/test/parallel/test-global-setters.js +++ b/test/parallel/test-global-setters.js @@ -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');