From 5dfaa4a0c1311868610d51d59718faa9d43d6ff7 Mon Sep 17 00:00:00 2001 From: Brian Terlson Date: Mon, 18 Jul 2016 13:08:06 -0700 Subject: [PATCH] Allow multiple test paths --- bin/run.js | 4 ++-- lib/findTest262.js | 1 - lib/globber.js | 26 ++++++++++++++++---------- package.json | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/bin/run.js b/bin/run.js index f0547ab..4bcd6bd 100755 --- a/bin/run.js +++ b/bin/run.js @@ -28,9 +28,9 @@ let test262Dir = argv.test262Dir; // Test Pipeline const pool = agentPool(Number(argv.threads), argv.hostType, argv.hostArgs, argv.hostPath); -const paths = globber(argv._[0]); +const paths = globber(argv._); if (!includesDir && !test262Dir) { - test262Dir = test262Finder(paths.fileEvents); + test262Dir = test262Finder(paths.fileEvents[0]); } const files = paths.map(pathToTestFile); const tests = files.map(compileFile); diff --git a/lib/findTest262.js b/lib/findTest262.js index 028f9f8..2e35646 100644 --- a/lib/findTest262.js +++ b/lib/findTest262.js @@ -6,7 +6,6 @@ const Path = require('path'); module.exports = findTest262Dir; function findTest262Dir(globber) { const set = globber.minimatch.set; - console.log(set); let baseDir; for (let i = 0; i < set.length; i++) { let base = []; diff --git a/lib/globber.js b/lib/globber.js index f790dab..557e5d0 100644 --- a/lib/globber.js +++ b/lib/globber.js @@ -2,21 +2,27 @@ const glob = require('glob'); const Rx = require('rx'); -function globber(g) { +function globber(paths) { + const files = new Rx.Subject(); + files.fileEvents = []; + const Glob = glob.Glob; - const fileEvents = new Glob(g); - const paths = new Rx.Subject(); - fileEvents.on('match', function (file) { - paths.onNext(file); - }); + paths.forEach(function (path) { + const fileEvents = new Glob(path); + + fileEvents.on('match', function (file) { + files.onNext(file); + }); + + fileEvents.on('end', function () { + files.onCompleted(); + }); - fileEvents.on('end', function () { - paths.onCompleted(); + files.fileEvents.push(fileEvents); }) - paths.fileEvents = fileEvents; - return paths; + return files; } module.exports = globber; diff --git a/package.json b/package.json index 8463a99..6a8fd7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "test262-harness", "repository": "bterlson/test262-harness", - "version": "2.0.2", + "version": "2.0.3", "description": "Node-based harness for test262", "main": "index.js", "bin": {