Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-preload.js')
-rw-r--r--test/parallel/test-preload.js83
1 files changed, 41 insertions, 42 deletions
diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js
index 3fbdac9c4d3..bf3c4a09cf5 100644
--- a/test/parallel/test-preload.js
+++ b/test/parallel/test-preload.js
@@ -32,43 +32,41 @@ const fixtureD = fixture('define-global.js');
const fixtureThrows = fixture('throws_error4.js');
// test preloading a single module works
-childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureA]) + ' ' +
- fixtureB,
- function(err, stdout, stderr) {
- assert.ifError(err);
- assert.strictEqual(stdout, 'A\nB\n');
- });
+childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA]) + ' ' + fixtureB,
+ function(err, stdout, stderr) {
+ if (err) throw err;
+ assert.strictEqual(stdout, 'A\nB\n');
+ });
// test preloading multiple modules works
-childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureA, fixtureB]) + ' ' +
- fixtureC,
+childProcess.exec(
+ nodeBinary + ' ' + preloadOption([fixtureA, fixtureB]) + ' ' + fixtureC,
function(err, stdout, stderr) {
- assert.ifError(err);
+ if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nC\n');
- });
+ }
+);
// test that preloading a throwing module aborts
-childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureA, fixtureThrows]) + ' ' +
- fixtureB,
+childProcess.exec(
+ nodeBinary + ' ' + preloadOption([fixtureA, fixtureThrows]) + ' ' + fixtureB,
function(err, stdout, stderr) {
if (err) {
assert.strictEqual(stdout, 'A\n');
} else {
throw new Error('Preload should have failed');
}
- });
+ }
+);
// test that preload can be used with --eval
-childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureA]) +
- '-e "console.log(\'hello\');"',
+childProcess.exec(
+ nodeBinary + ' ' + preloadOption([fixtureA]) + '-e "console.log(\'hello\');"',
function(err, stdout, stderr) {
- assert.ifError(err);
+ if (err) throw err;
assert.strictEqual(stdout, 'A\nhello\n');
- });
+ }
+);
// test that preload can be used with stdin
const stdinProc = childProcess.spawn(
@@ -108,42 +106,43 @@ replProc.on('close', function(code) {
// test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once
-childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureA]) +
- '-e "console.log(\'hello\');" ' +
- preloadOption([fixtureA, fixtureB]),
+childProcess.exec(
+ nodeBinary + ' ' + preloadOption([fixtureA]) +
+ '-e "console.log(\'hello\');" ' + preloadOption([fixtureA, fixtureB]),
function(err, stdout, stderr) {
- assert.ifError(err);
+ if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nhello\n');
- });
+ }
+);
// test that preload works with -i
-const interactive = childProcess.exec(nodeBinary + ' ' +
- preloadOption([fixtureD]) +
- '-i',
+const interactive = childProcess.exec(
+ nodeBinary + ' ' + preloadOption([fixtureD]) + '-i',
common.mustCall(function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, "> 'test'\n> ");
- }));
+ })
+);
interactive.stdin.write('a\n');
interactive.stdin.write('process.exit()\n');
-childProcess.exec(nodeBinary + ' ' +
- '--require ' + fixture('cluster-preload.js') + ' ' +
- fixture('cluster-preload-test.js'),
+childProcess.exec(
+ nodeBinary + ' ' + '--require ' + fixture('cluster-preload.js') + ' ' +
+ fixture('cluster-preload-test.js'),
function(err, stdout, stderr) {
- assert.ifError(err);
+ if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
- });
+ }
+);
// https://github.com/nodejs/node/issues/1691
process.chdir(common.fixturesDir);
-childProcess.exec(nodeBinary + ' ' +
- '--expose_debug_as=v8debug ' +
- '--require ' + fixture('cluster-preload.js') + ' ' +
- 'cluster-preload-test.js',
+childProcess.exec(
+ nodeBinary + ' ' + '--expose_debug_as=v8debug ' + '--require ' +
+ fixture('cluster-preload.js') + ' ' + 'cluster-preload-test.js',
function(err, stdout, stderr) {
- assert.ifError(err);
+ if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
- });
+ }
+);