summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-use-global.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-06-26 02:17:00 +0200
committerRich Trott <rtrott@gmail.com>2020-06-25 19:18:55 -0700
commit072feec1b0c8d381d1921bd196c9bffb51366585 (patch)
tree553e030fe52be1e164cbcc94a787f5ae638624b8 /test/parallel/test-repl-use-global.js
parent82f13fa803ac0b51f42118c26cc947b3101b6078 (diff)
downloadnode-new-072feec1b0c8d381d1921bd196c9bffb51366585.tar.gz
Revert "repl: always check for NODE_REPL_MODE environment variable"
This reverts commit b831b081c499a614c1ee3f0272c9de1783395402. This presumably unbreaks the ASAN github action build. Example failure: 2020-06-25T19:59:15.1448178Z === release test-repl-envvars === 2020-06-25T19:59:15.1448872Z Path: parallel/test-repl-envvars 2020-06-25T19:59:15.1449449Z --- stderr --- 2020-06-25T19:59:15.1449835Z assert.js:103 2020-06-25T19:59:15.1450194Z throw new AssertionError(obj); 2020-06-25T19:59:15.1450524Z ^ 2020-06-25T19:59:15.1450817Z 2020-06-25T19:59:15.1451431Z AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: 2020-06-25T19:59:15.1452000Z + actual - expected 2020-06-25T19:59:15.1452298Z 2020-06-25T19:59:15.1452634Z { 2020-06-25T19:59:15.1452978Z terminal: true, 2020-06-25T19:59:15.1453321Z + useColors: false 2020-06-25T19:59:15.1453861Z - useColors: true 2020-06-25T19:59:15.1454225Z } 2020-06-25T19:59:15.1454841Z at /home/runner/work/node/node/test/parallel/test-repl-envvars.js:55:12 2020-06-25T19:59:15.1455246Z at internal/repl.js:33:5 PR-URL: https://github.com/nodejs/node/pull/34058 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-use-global.js')
-rw-r--r--test/parallel/test-repl-use-global.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/parallel/test-repl-use-global.js b/test/parallel/test-repl-use-global.js
index f979b0c336..00222608de 100644
--- a/test/parallel/test-repl-use-global.js
+++ b/test/parallel/test-repl-use-global.js
@@ -14,19 +14,23 @@ const globalTestCases = [
[undefined, 'undefined']
];
-const globalTest = (cb, output) => (repl) => {
+const globalTest = (useGlobal, cb, output) => (err, repl) => {
+ if (err)
+ return cb(err);
+
let str = '';
output.on('data', (data) => (str += data));
global.lunch = 'tacos';
repl.write('global.lunch;\n');
repl.close();
delete global.lunch;
- cb(str.trim());
+ cb(null, str.trim());
};
// Test how the global object behaves in each state for useGlobal
for (const [option, expected] of globalTestCases) {
- runRepl(option, globalTest, common.mustCall((output) => {
+ runRepl(option, globalTest, common.mustCall((err, output) => {
+ assert.ifError(err);
assert.strictEqual(output, expected);
}));
}
@@ -39,7 +43,10 @@ for (const [option, expected] of globalTestCases) {
// suite is aware of it, causing a failure to be flagged.
//
const processTestCases = [false, undefined];
-const processTest = (cb, output) => (repl) => {
+const processTest = (useGlobal, cb, output) => (err, repl) => {
+ if (err)
+ return cb(err);
+
let str = '';
output.on('data', (data) => (str += data));
@@ -47,11 +54,12 @@ const processTest = (cb, output) => (repl) => {
repl.write('let process;\n');
repl.write('21 * 2;\n');
repl.close();
- cb(str.trim());
+ cb(null, str.trim());
};
for (const option of processTestCases) {
- runRepl(option, processTest, common.mustCall((output) => {
+ runRepl(option, processTest, common.mustCall((err, output) => {
+ assert.ifError(err);
assert.strictEqual(output, 'undefined\n42');
}));
}
@@ -68,5 +76,8 @@ function runRepl(useGlobal, testFunc, cb) {
prompt: ''
};
- repl.createInternalRepl(opts, testFunc(cb, opts.output));
+ repl.createInternalRepl(
+ process.env,
+ opts,
+ testFunc(useGlobal, cb, opts.output));
}