forked from jamesshore/lets_code_javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.js
More file actions
20 lines (17 loc) · 634 Bytes
/
make.js
File metadata and controls
20 lines (17 loc) · 634 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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");' +
'}';
script.to(file);
child.exec('node '+file, function(err, stdout, stderr) {
assert.ok(stdout.match('first'));
assert.ok(!stdout.match('second')); // Make should die on errors, so this should never get echoed
shell.exit(123);
});