diff options
author | Travis Warlick <twarlick@gmail.com> | 2016-07-12 12:44:49 -0400 |
---|---|---|
committer | Travis Warlick <twarlick@gmail.com> | 2016-07-14 12:46:08 -0400 |
commit | 396a8bbb616c7e901e9a4c2bb50fa62a1f82dedb (patch) | |
tree | 6ab06ad52aeb4543365bc9ad1d7116ad43e10170 | |
parent | 5a129751180000fecaa2748fde876a47ccef0f7c (diff) | |
download | async-396a8bbb616c7e901e9a4c2bb50fa62a1f82dedb.tar.gz |
Use @nodeonly mocha tag to prevent non-browser tests from running with karma
-rw-r--r-- | karma.conf.js | 7 | ||||
-rw-r--r-- | mocha_test/asyncify.js | 8 | ||||
-rw-r--r-- | mocha_test/forever.js | 4 | ||||
-rw-r--r-- | mocha_test/nextTick.js | 7 | ||||
-rw-r--r-- | mocha_test/parallel.js | 8 | ||||
-rw-r--r-- | mocha_test/series.js | 8 | ||||
-rw-r--r-- | mocha_test/support/is_browser.js | 4 | ||||
-rw-r--r-- | mocha_test/waterfall.js | 8 |
8 files changed, 13 insertions, 41 deletions
diff --git a/karma.conf.js b/karma.conf.js index 0e90828..62b5cb8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -12,6 +12,13 @@ module.exports = function(config) { browserify: { debug: true, transform: ['babelify'] + }, + + client: { + mocha: { + grep: '@nodeonly', + invert: true + } } }); }; diff --git a/mocha_test/asyncify.js b/mocha_test/asyncify.js index 880f2f2..480a3e6 100644 --- a/mocha_test/asyncify.js +++ b/mocha_test/asyncify.js @@ -1,7 +1,6 @@ var async = require('../lib'); var assert = require('assert'); var expect = require('chai').expect; -var isBrowser = require('./support/is_browser'); describe('asyncify', function(){ @@ -61,12 +60,7 @@ describe('asyncify', function(){ } }); - describe('promisified', function() { - if (isBrowser()) { - // node only tests - return; - } - + describe('promisified @nodeonly', function() { var names = [ 'native-promise-only', 'bluebird', diff --git a/mocha_test/forever.js b/mocha_test/forever.js index ec21ed7..e00a22d 100644 --- a/mocha_test/forever.js +++ b/mocha_test/forever.js @@ -1,6 +1,5 @@ var async = require('../lib'); var expect = require('chai').expect; -var isBrowser = require('./support/is_browser'); describe('forever', function(){ context('function is asynchronous', function(){ @@ -24,8 +23,7 @@ describe('forever', function(){ }); context('function is synchronous', function(){ - it('does not cause a stack overflow', function(done){ - if (isBrowser()) return done(); // this will take forever in a browser + it('does not cause a stack overflow @nodeonly', function(done){ // this will take forever in a browser var counter = 0; function addOne(callback) { counter++; diff --git a/mocha_test/nextTick.js b/mocha_test/nextTick.js index b428822..e590d94 100644 --- a/mocha_test/nextTick.js +++ b/mocha_test/nextTick.js @@ -13,12 +13,7 @@ describe("nextTick", function () { }, 50); }); - it('nextTick in the browser', function(done){ - if (!process.browser) { - // skip this test in node - return done(); - } - + it('nextTick in the browser @nodeonly', function(done){ var call_order = []; async.nextTick(function(){call_order.push('two');}); diff --git a/mocha_test/parallel.js b/mocha_test/parallel.js index 4f92642..2b07822 100644 --- a/mocha_test/parallel.js +++ b/mocha_test/parallel.js @@ -1,7 +1,6 @@ var async = require('../lib'); var expect = require('chai').expect; var assert = require('assert'); -var isBrowser = require('./support/is_browser'); var getFunctionsObject = require('./support/get_function_object'); describe('parallel', function() { @@ -192,12 +191,7 @@ describe('parallel', function() { }); }); - it('parallel call in another context @nycinvalid', function(done) { - if (isBrowser()) { - // node only test - done(); - return; - } + it('parallel call in another context @nycinvalid @nodeonly', function(done) { var vm = require('vm'); var sandbox = { async: async, diff --git a/mocha_test/series.js b/mocha_test/series.js index 80e54c2..7d737fa 100644 --- a/mocha_test/series.js +++ b/mocha_test/series.js @@ -1,7 +1,6 @@ var async = require('../lib'); var expect = require('chai').expect; var assert = require('assert'); -var isBrowser = require('./support/is_browser'); var getFunctionsObject = require('./support/get_function_object'); describe('series', function() { @@ -137,12 +136,7 @@ describe('series', function() { }); }); - it('call in another context @nycinvalid', function(done) { - if (isBrowser()) { - // node only test - done(); - return; - } + it('call in another context @nycinvalid @nodeonly', function(done) { var vm = require('vm'); var sandbox = { async: async, diff --git a/mocha_test/support/is_browser.js b/mocha_test/support/is_browser.js deleted file mode 100644 index 85e1522..0000000 --- a/mocha_test/support/is_browser.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function() { - return (typeof process === "undefined") || - (process + "" !== "[object process]"); // browserify -}; diff --git a/mocha_test/waterfall.js b/mocha_test/waterfall.js index c9abdc9..0c21c80 100644 --- a/mocha_test/waterfall.js +++ b/mocha_test/waterfall.js @@ -106,13 +106,7 @@ describe("waterfall", function () { }).to.throw(/already called/); }); - it('call in another context @nycinvalid', function(done) { - if (process.browser) { - // node only test - done(); - return; - } - + it('call in another context @nycinvalid @nodeonly', function(done) { var vm = require('vm'); var sandbox = { async: async, |