Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bterlson committed Oct 21, 2016
1 parent 9e17990 commit 330f05f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 16 additions & 3 deletions bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ const agentPool = require('../lib/agentPool.js');
const test262Finder = require('../lib/findTest262.js');
const scenariosForTest = require('../lib/scenarios.js');

// test262 directory (used to locate includes unless overridden with includesDir)
let test262Dir = argv.test262Dir;
// where to load includes from (usually a subdirectory of test262dir)
let includesDir = argv.includesDir;

// initialize reporter by attempting to load lib/reporters/${reporter}
// defaults to 'simple'
let reporter;
if (fs.existsSync(Path.join(__dirname, '../lib/reporters', argv.reporter + '.js'))) {
reporter = require('../lib/reporters/' + argv.reporter + '.js');
Expand All @@ -23,8 +30,13 @@ if (fs.existsSync(Path.join(__dirname, '../lib/reporters', argv.reporter + '.js'
process.exit(1);
}

let includesDir = argv.includesDir;
let test262Dir = argv.test262Dir;
// load preload contents
let preludeContents;
if (argv.prelude) {
preludeContents = fs.readFileSync(argv.prelude, 'utf8');
} else {
preludeContents = '';
}

// Select hostType and hostPath. hostType defaults to 'node'.
// If using default hostType, hostPath defaults to the current node executable location.
Expand Down Expand Up @@ -76,5 +88,6 @@ function pathToTestFile(path) {
}

function compileFile(contents) {
contents = preludeContents + contents;
return compile(contents, { test262Dir: test262Dir, includesDir: includesDir });
}
}
2 changes: 2 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const yargv = yargs
.describe('test262Dir', 'test262 root directory')
.describe('includesDir', 'directory where helper files are found')
.describe('threads', 'number of threads to use')
.describe('prelude', 'content to include above each test')
.nargs('prelude', 1)
.nargs('threads', 1)
.default('threads', 1)
.alias('threads', 't')
Expand Down

0 comments on commit 330f05f

Please sign in to comment.