From 2ad27de5198e299480c4cf8ab28c2db5cecd7132 Mon Sep 17 00:00:00 2001 From: Trent Willis Date: Sat, 18 Mar 2017 14:56:21 -0700 Subject: [PATCH] fixup! CLI: Introduce QUnit CLI --- bin/{qunitjs => qunit} | 0 bin/utils.js | 9 +++------ package.json | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) rename bin/{qunitjs => qunit} (100%) diff --git a/bin/qunitjs b/bin/qunit similarity index 100% rename from bin/qunitjs rename to bin/qunit diff --git a/bin/utils.js b/bin/utils.js index 965a40891..1664397bc 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -1,11 +1,12 @@ "use strict"; const walkSync = require( "walk-sync" ); -const fs = require( "fs" ); +const existsStat = require( "exists-stat" ); function getFilesFromArgs( args ) { let globs = args.slice(); + // Default to files in the test directory if ( !globs.length ) { globs.push( "test/*.js" ); } @@ -13,11 +14,7 @@ function getFilesFromArgs( args ) { // For each of the potential globs, we check if it is a directory path and // update it so that it matches the JS files in that directory. globs = globs.map( glob => { - let stat; - - try { - stat = fs.statSync( glob ); - } catch ( e ) {} + let stat = existsStat( glob ); if ( stat && stat.isDirectory() ) { return `${glob}/*.js`; diff --git a/package.json b/package.json index 49ff98832..d23e5d0f2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "bin": { - "qunit": "bin/qunitjs" + "qunit": "bin/qunit" }, "files": [ "bin/", @@ -32,6 +32,7 @@ ], "dependencies": { "commander": "2.9.0", + "exists-stat": "^1.0.0", "js-reporters": "1.1.0", "walk-sync": "0.3.1" },