Skip to content

Commit

Permalink
reorganize test hierarchy; closes #2838
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull authored and dasilvacontin committed Jun 4, 2017
1 parent 2bc9c4d commit f20de56
Show file tree
Hide file tree
Showing 59 changed files with 443 additions and 362 deletions.
52 changes: 26 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,79 +63,79 @@ test-jsapi:

test-unit:
@printf "==> [Test :: Unit]\n"
$(call test_node,unit) test/acceptance/*.js \
--growl \
test/*.js
$(call test_node,unit) test/unit/*.spec.js \
test/node-unit/*.spec.js \
--growl

test-integration:
@printf "==> [Test :: Integrations]\n"
$(call test_node,integration) --timeout 5000 \
test/integration/*.js
test/integration/*.spec.js

test-compilers:
@printf "==> [Test :: Compilers]\n"
$(call test_node,compilers) --compilers coffee:coffee-script/register,foo:./test/compiler/foo \
test/acceptance/test.coffee \
test/acceptance/test.foo
test/compiler/test.coffee \
test/compiler/test.foo

test-requires:
@printf "==> [Test :: Requires]\n"
$(call test_node,requires) --compilers coffee:coffee-script/register \
--require test/acceptance/require/a.js \
--require test/acceptance/require/b.coffee \
--require test/acceptance/require/c.js \
--require test/acceptance/require/d.coffee \
test/acceptance/require/require.spec.js
--require test/require/a.js \
--require test/require/b.coffee \
--require test/require/c.js \
--require test/require/d.coffee \
test/require/require.spec.js

test-bdd:
@printf "==> [Test :: BDD]\n"
$(call test_node,bdd) --ui bdd \
test/acceptance/interfaces/bdd.spec
test/interfaces/bdd.spec

test-tdd:
@printf "==> [Test :: TDD]\n"
$(call test_node,tdd) --ui tdd \
test/acceptance/interfaces/tdd.spec
test/interfaces/tdd.spec

test-qunit:
@printf "==> [Test :: QUnit]\n"
$(call test_node,qunit) --ui qunit \
test/acceptance/interfaces/qunit.spec
test/interfaces/qunit.spec

test-exports:
@printf "==> [Test :: Exports]\n"
$(call test_node,exports) --ui exports \
test/acceptance/interfaces/exports.spec
test/interfaces/exports.spec

test-glob:
@printf "==> [Test :: Glob]\n"
bash ./test/acceptance/glob/glob.sh
bash ./test/glob/glob.sh

test-reporters:
@printf "==> [Test :: Reporters]\n"
$(call test_node,reporters) test/reporters/*.js
$(call test_node,reporters) test/reporters/*.spec.js

test-only:
@printf "==> [Test :: Only]\n"
$(call test_node,only-tdd) --ui tdd \
test/acceptance/misc/only/tdd.spec
test/misc/only/tdd.spec

$(call test_node,only-bdd) --ui bdd \
test/acceptance/misc/only/bdd.spec
test/misc/only/bdd.spec

$(call test_node,only-bdd-require) --ui qunit \
test/acceptance/misc/only/bdd-require.spec
test/misc/only/bdd-require.spec

test-global-only:
@printf "==> [Test :: Global Only]\n"
$(call test_node,global-only-tdd) --ui tdd \
test/acceptance/misc/only/global/tdd.spec
test/misc/only/global/tdd.spec

$(call test_node,global-only-bdd) --ui bdd \
test/acceptance/misc/only/global/bdd.spec
test/misc/only/global/bdd.spec

$(call test_node,global-only-qunit) --ui qunit \
test/acceptance/misc/only/global/qunit.spec
test/misc/only/global/qunit.spec

test-mocha:
@printf "==> [Test :: Mocha]\n"
Expand All @@ -144,19 +144,19 @@ test-mocha:
non-tty:
@printf "==> [Test :: Non-TTY]\n"
$(call test_node,non-tty-dot) --reporter dot \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/dot.out
test/interfaces/bdd.spec 2>&1 > /tmp/dot.out

@echo dot:
@cat /tmp/dot.out

$(call test_node,non-tty-list) --reporter list \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/list.out
test/interfaces/bdd.spec 2>&1 > /tmp/list.out

@echo list:
@cat /tmp/list.out

$(call test_node,non-tty-spec) --reporter spec \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/spec.out
test/interfaces/bdd.spec 2>&1 > /tmp/spec.out

@echo spec:
@cat /tmp/spec.out
Expand Down
11 changes: 2 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ module.exports = function (config) {
// we use the BDD interface for all of the tests that
// aren't interface-specific.
'test/browser-fixtures/bdd.fixture.js',
'test/acceptance/*.spec.js'
],
exclude: [
'test/acceptance/http.spec.js',
'test/acceptance/fs.spec.js',
'test/acceptance/file-utils.spec.js',
'test/acceptance/require/**/*.js',
'test/acceptance/misc/**/*.js'
'test/unit/*.spec.js'
],
preprocessors: {
'test/**/*.js': ['browserify']
Expand Down Expand Up @@ -128,7 +121,7 @@ module.exports = function (config) {
}
cfg.files = [
'test/browser-fixtures/' + ui + '.fixture.js',
'test/acceptance/interfaces/' + ui + '.spec.js'
'test/interfaces/' + ui + '.spec.js'
];
} else if (cfg.sauceLabs) {
cfg.sauceLabs.testName = 'Unit Tests';
Expand Down
2 changes: 2 additions & 0 deletions test/browser-fixtures/bdd.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

/* eslint-env browser */

process.stdout = require('browser-stdout')();

window.mocha.timeout(200)
.ui('bdd');
2 changes: 2 additions & 0 deletions test/browser-fixtures/exports.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

/* eslint-env browser */

process.stdout = require('browser-stdout')();

window.mocha.timeout(200)
.ui('exports');
2 changes: 2 additions & 0 deletions test/browser-fixtures/qunit.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

/* eslint-env browser */

process.stdout = require('browser-stdout')();

window.mocha.timeout(200)
.ui('qunit');
2 changes: 2 additions & 0 deletions test/browser-fixtures/tdd.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

/* eslint-env browser */

process.stdout = require('browser-stdout')();

window.mocha.timeout(200)
.ui('tdd');
3 changes: 3 additions & 0 deletions test/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
These files need to be run manually by loading the `.html` file(s) in a browser.

It would be awesome if we could automate that!
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions test/acceptance/glob/glob.sh → test/glob/glob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cd $SCRIPT_DIR || {
exit 1
}

../../../bin/mocha -R json-stream ./*.js > /tmp/mocha-glob.txt || {
../../bin/mocha -R json-stream ./*.js > /tmp/mocha-glob.txt || {
echo Globbing ./*.js in `pwd` failed.
exit 1
}
Expand All @@ -17,7 +17,7 @@ cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"p
exit 1
}

../../../bin/mocha -R json-stream ./*-none.js 2> /tmp/mocha-glob.txt && {
../../bin/mocha -R json-stream ./*-none.js 2> /tmp/mocha-glob.txt && {
echo Globbing './*-none.js' in `pwd` failed.
exit 1
}
Expand All @@ -27,7 +27,7 @@ cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pat
exit 1
}

../../../bin/mocha -R json-stream ./*.js ./*-none.js >& /tmp/mocha-glob.txt || {
../../bin/mocha -R json-stream ./*.js ./*-none.js >& /tmp/mocha-glob.txt || {
echo Globbing ./*.js ./*-none.js in `pwd` failed.
exit 1
}
Expand All @@ -43,7 +43,7 @@ cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pat
# In windows, the shell passes globs unexpanded, executables do expansion if they support it.
# Adding single-quotes around the glob below makes bash pass glob unexpanded,
# allowing us to test windows-style globbing in bash.
../../../bin/mocha -R json-stream './*.js' > /tmp/mocha-glob.txt || {
../../bin/mocha -R json-stream './*.js' > /tmp/mocha-glob.txt || {
echo Globbing './*.js' in `pwd` failed.
exit 1
}
Expand All @@ -53,7 +53,7 @@ cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"p
exit 1
}

../../../bin/mocha -R json-stream './*-none.js' 2> /tmp/mocha-glob.txt && {
../../bin/mocha -R json-stream './*-none.js' 2> /tmp/mocha-glob.txt && {
echo Globbing './*-none.js' in `pwd` failed.
exit 1
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions test/jsapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ var mocha = new Mocha({
// mocha.reporter('spec');
require('should');

mocha.addFile('test/suite.spec.js');
mocha.addFile('test/runner.spec.js');
mocha.addFile('test/runnable.spec.js');
mocha.addFile('test/hook-sync.spec.js');
mocha.addFile('test/hook-sync-nested.spec.js');
mocha.addFile('test/hook-async.spec.js');
mocha.addFile('test/acceptance/duration.spec.js');
mocha.addFile('test/acceptance/fs.spec.js');
mocha.addFile('test/acceptance/globals.spec.js');
mocha.addFile('test/acceptance/timeout.spec.js');
mocha.addFile('test/unit/suite.spec.js');
mocha.addFile('test/unit/runner.spec.js');
mocha.addFile('test/unit/runnable.spec.js');
mocha.addFile('test/unit/hook-sync.spec.js');
mocha.addFile('test/unit/hook-sync-nested.spec.js');
mocha.addFile('test/unit/hook-async.spec.js');
mocha.addFile('test/unit/duration.spec.js');
mocha.addFile('test/node-unit/fs.spec.js');
mocha.addFile('test/unit/globals.spec.js');
mocha.addFile('test/unit/timeout.spec.js');

mocha.run(function () {
console.log('done');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/* jshint node: true */

var mocha = require('../../../../lib/mocha');
var mocha = require('../../../lib/mocha');

var beforeEach = mocha.beforeEach;
var it = mocha.it;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f20de56

Please sign in to comment.