shelljs/test/make.js
Nate Fischer 2395214fee chore: switch to eslint (#504)
* chore: switch to eslint

* fix: works on older versions of NodeJS now

* chore: fix curly braces

* chore: fix indents and remove jshint references
2016-08-07 12:16:29 -07:00

21 lines
684 B
JavaScript

var shell = require('..');
var child = require('child_process');
var assert = require('assert');
shell.mkdir('-p', 'tmp');
var file = 'tmp/tempscript' + Math.random() + '.js';
var script = 'require(\'../../make.js\');' +
'target.all=function(){' +
' echo("first"); ' +
' cp("this_file_doesnt_exist", ".");' +
' echo("second");' +
'}';
shell.ShellString(script).to(file);
child.exec(JSON.stringify(process.execPath) + ' ' + 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);
});