couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to e688789
Date Wed, 19 Nov 2014 13:10:08 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 8a49da5ca -> e68878980


Enable passing a single test to nightwatch

You can now pass single testfiles to nightwatch which makes
development of tests easier and faster.

Example:
`grunt nightwatch --file="createsDatabase"` launches the
createsDatabase.js testfile in app/databases/tests/nightwatch

Happy testing!


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

Branch: refs/heads/master
Commit: e68878980330872d6a2a748b82a547208696b516
Parents: 8a49da5
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Tue Nov 18 17:55:47 2014 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Wed Nov 19 14:09:17 2014 +0100

----------------------------------------------------------------------
 Gruntfile.js                               | 34 +++++++++++++++++++++++++
 test/nightwatch_tests/nightwatch_README.md |  6 +++++
 2 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e6887898/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index be6b2dc..86ef8df 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -424,6 +424,40 @@ module.exports = function(grunt) {
     }
   });
 
+
+  // enable running of a single test with nightwatch
+  var fileArg = grunt.option('file');
+  if (fileArg) {
+    fileArg = fileArg + '.js';
+    var nightwatchConf = require('./test/nightwatch_tests/nightwatch.json'),
+        paths;
+
+    paths = nightwatchConf.src_folders.reduce(function (acc, dir) {
+      if (fs.existsSync(dir + '/' + fileArg)) {
+        acc.push(dir + '/' + fileArg);
+      }
+      return acc;
+    }, []);
+
+    if (paths.length > 1) {
+      throw new Error('Found multiple tests');
+    }
+
+    if (!paths.length) {
+      throw new Error('Found no testfile named ' + fileArg);
+    }
+
+    grunt.config.merge({
+      exec: {
+        start_nightWatch: {
+           command: __dirname + '/node_modules/nightwatch/bin/nightwatch' +
+            ' -t ' + paths[0] +
+            ' -e chrome -c ' + __dirname + '/test/nightwatch_tests/nightwatch.json'
+        }
+      }
+    });
+  }
+
   /*
    * Load Grunt plugins
    */

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e6887898/test/nightwatch_tests/nightwatch_README.md
----------------------------------------------------------------------
diff --git a/test/nightwatch_tests/nightwatch_README.md b/test/nightwatch_tests/nightwatch_README.md
index 092a094..b4aed76 100644
--- a/test/nightwatch_tests/nightwatch_README.md
+++ b/test/nightwatch_tests/nightwatch_README.md
@@ -18,6 +18,12 @@ Then, to run the the test:
     $ grunt nightwatch
 
 
+You can run individual single tests by running
+
+    $ grunt nightwatch --file="createsDatabase"
+
+if you want to run the testfile `createsDatabase.js`.
+
 ##Writing Tests
 You can contribute by writing tests for Fauxton as well.  
   


Mime
View raw message