Skip to content

Commit 7a05a6c

Browse files
committed
use spec reporter in tests by default; closes #2594
1 parent 004389f commit 7a05a6c

File tree

6 files changed

+28
-44
lines changed

6 files changed

+28
-44
lines changed

Makefile

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ESLINT := "node_modules/.bin/eslint"
33
KARMA := "node_modules/.bin/karma"
44
MOCHA := "bin/mocha"
55

6-
REPORTER ?= spec
76
TM_BUNDLE = JavaScript\ mocha.tmbundle
87
SRC = $(shell find lib -name "*.js" -type f | sort)
98
TESTS = $(shell find test -name "*.js" -type f | sort)
@@ -55,28 +54,24 @@ test-jsapi:
5554

5655
test-unit:
5756
@printf "==> [Test :: Unit]\n"
58-
$(MOCHA) --reporter $(REPORTER) \
59-
test/acceptance/*.js \
57+
$(MOCHA) test/acceptance/*.js \
6058
--growl \
6159
test/*.js
6260

6361
test-integration:
6462
@printf "==> [Test :: Integrations]\n"
6563
$(MOCHA) --timeout 5000 \
66-
--reporter $(REPORTER) \
6764
test/integration/*.js
6865

6966
test-compilers:
7067
@printf "==> [Test :: Compilers]\n"
71-
$(MOCHA) --reporter $(REPORTER) \
72-
--compilers coffee:coffee-script/register,foo:./test/compiler/foo \
68+
$(MOCHA) --compilers coffee:coffee-script/register,foo:./test/compiler/foo \
7369
test/acceptance/test.coffee \
7470
test/acceptance/test.foo
7571

7672
test-requires:
7773
@printf "==> [Test :: Requires]\n"
78-
$(MOCHA) --reporter $(REPORTER) \
79-
--compilers coffee:coffee-script/register \
74+
$(MOCHA) --compilers coffee:coffee-script/register \
8075
--require test/acceptance/require/a.js \
8176
--require test/acceptance/require/b.coffee \
8277
--require test/acceptance/require/c.js \
@@ -85,26 +80,22 @@ test-requires:
8580

8681
test-bdd:
8782
@printf "==> [Test :: BDD]\n"
88-
$(MOCHA) --reporter $(REPORTER) \
89-
--ui bdd \
83+
$(MOCHA) --ui bdd \
9084
test/acceptance/interfaces/bdd.spec
9185

9286
test-tdd:
9387
@printf "==> [Test :: TDD]\n"
94-
$(MOCHA) --reporter $(REPORTER) \
95-
--ui tdd \
88+
$(MOCHA) --ui tdd \
9689
test/acceptance/interfaces/tdd.spec
9790

9891
test-qunit:
9992
@printf "==> [Test :: QUnit]\n"
100-
$(MOCHA) --reporter $(REPORTER) \
101-
--ui qunit \
93+
$(MOCHA) --ui qunit \
10294
test/acceptance/interfaces/qunit.spec
10395

10496
test-exports:
10597
@printf "==> [Test :: Exports]\n"
106-
$(MOCHA) --reporter $(REPORTER) \
107-
--ui exports \
98+
$(MOCHA) --ui exports \
10899
test/acceptance/interfaces/exports.spec
109100

110101
test-glob:
@@ -113,41 +104,33 @@ test-glob:
113104

114105
test-reporters:
115106
@printf "==> [Test :: Reporters]\n"
116-
$(MOCHA) --reporter $(REPORTER) \
117-
test/reporters/*.js
107+
$(MOCHA) test/reporters/*.js
118108

119109
test-only:
120110
@printf "==> [Test :: Only]\n"
121-
$(MOCHA) --reporter $(REPORTER) \
122-
--ui tdd \
111+
$(MOCHA) --ui tdd \
123112
test/acceptance/misc/only/tdd.spec
124113

125-
$(MOCHA) --reporter $(REPORTER) \
126-
--ui bdd \
114+
$(MOCHA) --ui bdd \
127115
test/acceptance/misc/only/bdd.spec
128116

129-
$(MOCHA) --reporter $(REPORTER) \
130-
--ui qunit \
117+
$(MOCHA) --ui qunit \
131118
test/acceptance/misc/only/bdd-require.spec
132119

133120
test-global-only:
134121
@printf "==> [Test :: Global Only]\n"
135-
$(MOCHA) --reporter $(REPORTER) \
136-
--ui tdd \
122+
$(MOCHA) --ui tdd \
137123
test/acceptance/misc/only/global/tdd.spec
138124

139-
$(MOCHA) --reporter $(REPORTER) \
140-
--ui bdd \
125+
$(MOCHA) --ui bdd \
141126
test/acceptance/misc/only/global/bdd.spec
142127

143-
$(MOCHA) --reporter $(REPORTER) \
144-
--ui qunit \
128+
$(MOCHA) --ui qunit \
145129
test/acceptance/misc/only/global/qunit.spec
146130

147131
test-mocha:
148132
@printf "==> [Test :: Mocha]\n"
149-
$(MOCHA) --reporter $(REPORTER) \
150-
test/mocha
133+
$(MOCHA) test/mocha
151134

152135
non-tty:
153136
@printf "==> [Test :: Non-TTY]\n"

test/integration/helpers.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,22 @@ module.exports = {
2222
* output: '...'
2323
* }
2424
*
25-
* @param {string} fixturePath
26-
* @param {array} args
27-
* @param {function} fn
25+
* @param {string} fixturePath - Path to fixture .js file
26+
* @param {Array<string>} args - Extra args to mocha executable
27+
* @param {Function} done - Callback
2828
*/
29-
runMocha: function (fixturePath, args, fn) {
29+
runMocha: function (fixturePath, args, done) {
3030
var path;
3131

3232
path = resolveFixturePath(fixturePath);
3333
args = args || [];
3434

3535
invokeMocha(args.concat(['-C', path]), function (err, res) {
36-
if (err) return fn(err);
36+
if (err) {
37+
return done(err);
38+
}
3739

38-
fn(null, getSummary(res));
40+
done(null, getSummary(res));
3941
});
4042
},
4143

test/integration/hook-err.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('hook error handling', function () {
186186

187187
function run (fnPath, outputFilter) {
188188
return function (done) {
189-
runMocha(fnPath, [], function (err, res) {
189+
runMocha(fnPath, ['--reporter', 'dot'], function (err, res) {
190190
assert.ifError(err);
191191

192192
lines = res.output

test/integration/hooks.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

33
var assert = require('assert');
4-
var run = require('./helpers').runMocha;
4+
var runMocha = require('./helpers').runMocha;
55
var splitRegExp = require('./helpers').splitRegExp;
6-
var args = [];
6+
var args = ['--reporter', 'dot'];
77

88
describe('hooks', function () {
99
it('are ran in correct order', function (done) {
10-
run('cascade.fixture.js', args, function (err, res) {
10+
runMocha('cascade.fixture.js', args, function (err, res) {
1111
var lines, expected;
1212

1313
assert(!err);

test/integration/retries.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var assert = require('assert');
44
var helpers = require('./helpers');
5-
var args = [];
5+
var args = ['--reporter', 'dot'];
66
var bang = require('../../lib/reporters/base').symbols.bang;
77

88
describe('retries', function () {

test/mocha.opts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
--require should
22
--require ./test/setup
3-
--reporter dot
43
--ui bdd
54
--globals okGlobalA,okGlobalB
65
--globals okGlobalC

0 commit comments

Comments
 (0)