shelljs/test/make.js
Nate Fischer 6ebc2d3db7 refactor(shellstring): return consistent objects
- fix(string): no longer overrides string prototype
 - exec() now returns a ShellString object
2016-02-19 14:54:30 -08:00

21 lines
645 B
JavaScript

var shell = require('..'),
child = require('child_process'),
assert = require('assert');
shell.mkdir('-p', 'tmp');
var file = 'tmp/tempscript'+Math.random()+'.js',
script = 'require(\'../../make.js\');' +
'target.all=function(){' +
' echo("first"); '+
' cp("this_file_doesnt_exist", ".");' +
' echo("second");' +
'}';
shell.ShellString(script).to(file);
child.exec('node '+file, function(err, stdout) {
assert.ok(stdout.match('first'));
assert.ok(!stdout.match('second')); // Make should die on errors, so this should never get echoed
shell.exit(123);
});