summaryrefslogtreecommitdiff
path: root/test/parallel/test-common.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-08-22 09:17:19 -0700
committerJames M Snell <jasnell@gmail.com>2018-08-24 09:53:58 -0700
commit5da834f685f85af477afcb193d283f14a5244025 (patch)
tree1d86045f11e1cad9622be34a8a907b4972493624 /test/parallel/test-common.js
parentea8b932f30665436796c7e5abd485f048a0f41c8 (diff)
downloadandroid-node-v8-5da834f685f85af477afcb193d283f14a5244025.tar.gz
android-node-v8-5da834f685f85af477afcb193d283f14a5244025.tar.bz2
android-node-v8-5da834f685f85af477afcb193d283f14a5244025.zip
test: move hijackstdio out of require('common')
Move the hijackstdio functions out of common so that they are imported only into the tests that actually need them PR-URL: https://github.com/nodejs/node/pull/22462 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-common.js')
-rw-r--r--test/parallel/test-common.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js
index 7a89b37660..eafe4dd830 100644
--- a/test/parallel/test-common.js
+++ b/test/parallel/test-common.js
@@ -21,6 +21,7 @@
'use strict';
const common = require('../common');
+const hijackstdio = require('../common/hijackstdio');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { execFile } = require('child_process');
@@ -95,7 +96,7 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ];
const stream = process[`std${txt}`];
const originalWrite = stream.write;
- common[`hijackStd${txt}`](common.mustCall(function(data) {
+ hijackstdio[`hijackStd${txt}`](common.mustCall(function(data) {
assert.strictEqual(data, HIJACK_TEST_ARRAY[stream.writeTimes]);
}, HIJACK_TEST_ARRAY.length));
assert.notStrictEqual(originalWrite, stream.write);
@@ -105,14 +106,14 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ];
});
assert.strictEqual(HIJACK_TEST_ARRAY.length, stream.writeTimes);
- common[`restoreStd${txt}`]();
+ hijackstdio[`restoreStd${txt}`]();
assert.strictEqual(originalWrite, stream.write);
});
// hijackStderr and hijackStdout again
// for console
[[ 'err', 'error' ], [ 'out', 'log' ]].forEach(([ type, method ]) => {
- common[`hijackStd${type}`](common.mustCall(function(data) {
+ hijackstdio[`hijackStd${type}`](common.mustCall(function(data) {
assert.strictEqual(data, 'test\n');
// throw an error
@@ -120,7 +121,7 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ];
}));
console[method]('test');
- common[`restoreStd${type}`]();
+ hijackstdio[`restoreStd${type}`]();
});
let uncaughtTimes = 0;