Skip to content

Commit

Permalink
Better consoleCommand path handling. Add consoleArguments option.
Browse files Browse the repository at this point in the history
  • Loading branch information
bterlson committed Aug 17, 2015
1 parent f9b0dcd commit 8a3c02d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
11 changes: 10 additions & 1 deletion bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ cli.launch({
require(env.configPath);
}

// If we've loaded a console command config path,
// add it to the
if(t262.config.consoleCommand) {
t262.config.consoleCommand = path.join(env.cwd, t262.config.consoleCommand);
}

// command line flags override anything specified by config files
t262.useConfig(args);

applyDefaults(t262.config);

var Runner = t262.loadRunner();
Expand Down Expand Up @@ -277,6 +283,8 @@ function applyDefaults(config) {
}
}
}

if(!config.consoleArguments) config.consoleArguments = "";
}

function getFilesStream(config) {
Expand Down Expand Up @@ -324,6 +332,7 @@ function printHelp() {
console.log(" -C, --compile Save compiled tests.");
console.log(" -o, --outputDir Output directory for compiled tests.");
console.log(" -e, --consoleCommand Command for console runner.");
console.log(" --consoleArguments Arguments for console runner.");
console.log(" -p, --consolePrintCommand Print command.");
console.log(" -t, --threads Run this many tests in parallel.");
console.log(" -b, --batch How many tests to batch together.");
Expand Down
4 changes: 2 additions & 2 deletions lib/runners/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var batchDoneFn = function $DONE(err) {


function ConsoleRunner(args) {
this.command = args.consoleCommand;
if(!args.consoleCommand) throw "--consoleCommand option required for console runner";
this.command = args.consoleCommand + " " + args.consoleArguments;
this.printCommand = args.consolePrintCommand || "console.log";

if(args.batch) {
Expand All @@ -37,7 +38,6 @@ function ConsoleRunner(args) {
}
}

if(!this.command) throw "--consoleCommand option required for console runner";
if (!this._setRealmValue) {
this._setRealmValue = function(env, property, value) {
env[property] = value;
Expand Down
4 changes: 3 additions & 1 deletion lib/runners/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ function NodeRunner(args) {
if(!args.compileOnly) {
// HACK: Probably doesn't handle quoted arguments and other
// complexities.
var parts = args.consoleCommand.split(" ");
var parts = (args.consoleCommand + " " + args.consoleArguments)
.trim()
.split(" ");
parts.push(__dirname + '/nodehost.js');

this._instance = cp.spawn(parts[0], parts.slice(1));
Expand Down

0 comments on commit 8a3c02d

Please sign in to comment.