@ -19,15 +19,15 @@ var filename = __filename.replace(/\\/g, '/');
// assert that nothing is written to stdout
child . exec ( nodejs + ' --eval 42' ,
function ( err , stdout , stderr ) {
assert . e qual( stdout , '' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ;
// assert that "42\n" is written to stderr
child . exec ( nodejs + ' --eval "console.error(42)"' ,
function ( err , stdout , stderr ) {
assert . e qual( stdout , '' ) ;
assert . e qual( stderr , '42\n' ) ;
assert . strictE qual( stdout , '' ) ;
assert . strictE qual( stderr , '42\n' ) ;
} ) ;
// assert that the expected output is written to stdout
@ -36,21 +36,21 @@ child.exec(nodejs + ' --eval "console.error(42)"',
child . exec ( cmd + '42' ,
function ( err , stdout , stderr ) {
assert . e qual( stdout , '42\n' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '42\n' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ;
child . exec ( cmd + "'[]'" , common . mustCall (
function ( err , stdout , stderr ) {
assert . e qual( stdout , '[]\n' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '[]\n' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ) ;
} ) ;
// assert that module loading works
child . exec ( nodejs + ' --eval "require(\'' + filename + '\')"' ,
function ( status , stdout , stderr ) {
assert . e qual( status . code , 42 ) ;
assert . strictE qual( status . code , 42 ) ;
} ) ;
// Check that builtin modules are pre-defined.
@ -63,7 +63,7 @@ child.exec(nodejs + ' --print "os.platform()"',
// module path resolve bug, regression test
child . exec ( nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"' ,
function ( status , stdout , stderr ) {
assert . e qual( status . code , 42 ) ;
assert . strictE qual( status . code , 42 ) ;
} ) ;
// Missing argument should not crash
@ -74,28 +74,29 @@ child.exec(nodejs + ' -e', common.mustCall(function(status, stdout, stderr) {
// empty program should do nothing
child . exec ( nodejs + ' -e ""' , function ( status , stdout , stderr ) {
assert . e qual( stdout , '' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ;
// "\\-42" should be interpreted as an escaped expression, not a switch
child . exec ( nodejs + ' -p "\\-42"' ,
function ( err , stdout , stderr ) {
assert . e qual( stdout , '-42\n' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '-42\n' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ;
child . exec ( nodejs + ' --use-strict -p process.execArgv' ,
function ( status , stdout , stderr ) {
assert . equal ( stdout , "[ '--use-strict', '-p', 'process.execArgv' ]\n" ) ;
assert . strictEqual ( stdout ,
"[ '--use-strict', '-p', 'process.execArgv' ]\n" ) ;
} ) ;
// Regression test for https://github.com/nodejs/node/issues/3574
const emptyFile = path . join ( common . fixturesDir , 'empty.js' ) ;
child . exec ( nodejs + ` -e 'require("child_process").fork(" ${ emptyFile } ")' ` ,
function ( status , stdout , stderr ) {
assert . e qual( stdout , '' ) ;
assert . e qual( stderr , '' ) ;
assert . strictE qual( stdout , '' ) ;
assert . strictE qual( stderr , '' ) ;
} ) ;
// Regression test for https://github.com/nodejs/node/issues/8534.