mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

This reverts commit b831b081c4
.
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>
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
/* eslint-disable quotes */
|
|
'use strict';
|
|
require('../common');
|
|
const { Duplex } = require('stream');
|
|
const { inspect } = require('util');
|
|
const { strictEqual } = require('assert');
|
|
const { REPLServer } = require('repl');
|
|
|
|
let output = '';
|
|
|
|
const inout = new Duplex({ decodeStrings: false });
|
|
inout._read = function() {
|
|
this.push('util.inspect("string")\n');
|
|
this.push(null);
|
|
};
|
|
inout._write = function(s, _, cb) {
|
|
output += s;
|
|
cb();
|
|
};
|
|
|
|
const repl = new REPLServer({ input: inout, output: inout, useColors: true });
|
|
inout.isTTY = true;
|
|
const repl2 = new REPLServer({ input: inout, output: inout });
|
|
|
|
process.on('exit', function() {
|
|
// https://github.com/nodejs/node/pull/16485#issuecomment-350428638
|
|
// The color setting of the REPL should not have leaked over into
|
|
// the color setting of `util.inspect.defaultOptions`.
|
|
strictEqual(output.includes(`"'string'"`), true);
|
|
strictEqual(output.includes(`'\u001b[32m\\'string\\'\u001b[39m'`), false);
|
|
strictEqual(inspect.defaultOptions.colors, false);
|
|
strictEqual(repl.writer.options.colors, true);
|
|
strictEqual(repl2.writer.options.colors, true);
|
|
});
|