~cyphermox/cordova-cli/flatten

« back to all changes in this revision

Viewing changes to node_modules/cordova/node_modules/shelljs/test/config.js

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2013-12-12 05:26:53 UTC
  • Revision ID: mathieu-tl@ubuntu.com-20131212052653-eatjt8zguqua5qmq
testing the flattenage, yo

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var shell = require('..');
2
 
 
3
 
var assert = require('assert'),
4
 
    child = require('child_process');
5
 
 
6
 
function numLines(str) {
7
 
  return typeof str === 'string' ? str.match(/\n/g).length : 0;
8
 
}
9
 
 
10
 
//
11
 
// config.silent
12
 
//
13
 
 
14
 
assert.equal(shell.config.silent, false); // default
15
 
 
16
 
shell.config.silent = true;
17
 
assert.equal(shell.config.silent, true);
18
 
 
19
 
shell.config.silent = false;
20
 
assert.equal(shell.config.silent, false);
21
 
 
22
 
//
23
 
// config.fatal
24
 
//
25
 
 
26
 
assert.equal(shell.config.fatal, false); // default
27
 
 
28
 
//
29
 
// config.fatal = false
30
 
//
31
 
shell.mkdir('-p', 'tmp');
32
 
var file = 'tmp/tempscript'+Math.random()+'.js',
33
 
    script = 'require(\'../../global.js\'); config.silent=true; config.fatal=false; cp("this_file_doesnt_exist", "."); echo("got here");';
34
 
script.to(file);
35
 
child.exec('node '+file, function(err, stdout, stderr) {
36
 
  assert.ok(stdout.match('got here'));
37
 
 
38
 
  //
39
 
  // config.fatal = true
40
 
  //
41
 
  shell.mkdir('-p', 'tmp');
42
 
  var file = 'tmp/tempscript'+Math.random()+'.js',
43
 
      script = 'require(\'../../global.js\'); config.silent=true; config.fatal=true; cp("this_file_doesnt_exist", "."); echo("got here");';
44
 
  script.to(file);
45
 
  child.exec('node '+file, function(err, stdout, stderr) {
46
 
    assert.ok(!stdout.match('got here'));
47
 
 
48
 
    shell.exit(123);
49
 
  });
50
 
});