-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -J|--jobs-auto to automatically calculate cores
This PR allows you to pass in -J which will automatically calculate the number of cores using `os.cpus.length()` Fixes: #342 Fixes: #344
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var t = require('../') | ||
var spawn = require('child_process').spawn | ||
var expect = { | ||
jobs: require('os').cpus().length | ||
} | ||
var node = process.execPath | ||
var run = require.resolve('../bin/run.js') | ||
|
||
var args = [ | ||
['-J'], | ||
['--jobs=99999', '-J'], | ||
['--jobs-auto'], | ||
['--jobs=99999', '--jobs-auto'] | ||
] | ||
|
||
t.plan(args.length) | ||
|
||
args.forEach(function (arg) { | ||
t.test(arg.join(' '), function (t) { | ||
var child = spawn(node, [run, '-J', '--dump-config']) | ||
var out = '' | ||
child.stdout.on('data', function (c) { | ||
out += c | ||
}) | ||
child.on('close', function (code, signal) { | ||
t.notOk(code) | ||
t.notOk(signal) | ||
t.match(JSON.parse(out), expect) | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
|