Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 191ef07dd -> b539e8ba6


Grunt mocha test file existence check

This is a small tweak to a recent commit that does an up-front
check to confirm the mocha test exists. It had failed to check
the condition where the user was trying to run a .js mocha test
for a ,jsx file that hadn't yet been compiled. This expands on the
existence check for a .jsx version of the file.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/b539e8ba
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/b539e8ba
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/b539e8ba

Branch: refs/heads/master
Commit: b539e8ba69f4edd0ffc48ba9e8541428e627a9d1
Parents: 191ef07
Author: Ben Keen <ben.k...@gmail.com>
Authored: Tue Oct 6 19:57:01 2015 -0700
Committer: Ben Keen <ben.k...@gmail.com>
Committed: Tue Oct 6 19:57:01 2015 -0700

----------------------------------------------------------------------
 tasks/fauxton.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b539e8ba/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/tasks/fauxton.js b/tasks/fauxton.js
index 630b3ed..66b7398 100644
--- a/tasks/fauxton.js
+++ b/tasks/fauxton.js
@@ -112,7 +112,9 @@ module.exports = function (grunt) {
   // This dies immediately if the file doesn't exist and notifies the user.
   grunt.registerMultiTask('checkTestExists', 'Confirms that if a specific 
mocha test exists', function () {
     var fileSrc = grunt.option('file');
-    if (fileSrc && !fs.existsSync(fileSrc)) {
+
+    // the + 'x' check checks for jsx files that haven't been compiled yet
+    if (fileSrc && !fs.existsSync(fileSrc) && !fs.existsSync(fileSrc + 'x')) {
       grunt.fail.fatal('Mocha test file not found: ' + fileSrc);
     }
   });

Reply via email to