Skip to content

Commit b43411c

Browse files
Corrected failing unit tests
1 parent 900c73c commit b43411c

17 files changed

+223
-170
lines changed

lib/reporters/html.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var statsTemplate =
4040
var playIcon = '‣';
4141

4242
class HTML extends Base {
43-
static browserOnly = true;
4443

4544
/**
4645
* @public
@@ -287,6 +286,8 @@ class HTML extends Base {
287286
}
288287
}
289288

289+
HTML.browserOnly = true;
290+
290291
/**
291292
* Makes a URL, preserving querystring ("search") parameters.
292293
*

lib/reporters/list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class List extends Base {
5656
Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
5757
});
5858

59-
runner.once(EVENT_RUN_END, self.epilogue.bind(self));
59+
runner.once(EVENT_RUN_END, (...args) => this.epilogue(...args));
6060
}
6161
}
6262

lib/reporters/min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Min extends Base {
3030
process.stdout.write('\u001b[1;3H');
3131
});
3232

33-
runner.once(EVENT_RUN_END, this.epilogue.bind(this));
33+
runner.once(EVENT_RUN_END, (...args) => this.epilogue(...args));
3434
}
3535
}
3636

lib/reporters/spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Spec extends Base {
7777
Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
7878
});
7979

80-
runner.once(EVENT_RUN_END, self.epilogue.bind(self));
80+
runner.once(EVENT_RUN_END, (...args) => this.epilogue(...args));
8181
}
8282
}
8383

lib/reporters/xunit.js

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class XUnit extends Base {
3131
* @param {Runner} runner - Instance triggers reporter actions.
3232
* @param {Object} [options] - runner options
3333
*/
34-
3534
constructor(runner, options) {
3635
super(runner, options);
3736

test/reporters/doc.spec.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var reporters = require('../../').reporters;
66

77
var Doc = reporters.Doc;
88
var createMockRunner = helpers.createMockRunner;
9-
var makeRunReporter = helpers.createRunReporterFunction;
9+
var createRunReporterFunction = helpers.createRunReporterFunction;
1010

1111
var EVENT_SUITE_BEGIN = events.EVENT_SUITE_BEGIN;
1212
var EVENT_SUITE_END = events.EVENT_SUITE_END;
@@ -16,7 +16,7 @@ var EVENT_TEST_PASS = events.EVENT_TEST_PASS;
1616
describe('Doc reporter', function () {
1717
var runner;
1818
var options = {};
19-
var runReporter = makeRunReporter(Doc);
19+
var runReporter = createRunReporterFunction(Doc);
2020

2121
afterEach(function () {
2222
runner = null;
@@ -32,15 +32,15 @@ describe('Doc reporter', function () {
3232
title: expectedTitle
3333
};
3434

35-
it('should log html with indents and expected title', function () {
35+
it('should log html with indents and expected title', async function () {
3636
runner = createMockRunner(
3737
'suite',
3838
EVENT_SUITE_BEGIN,
3939
null,
4040
null,
4141
suite
4242
);
43-
var stdout = runReporter(this, runner, options);
43+
var {stdout} = await runReporter({}, runner, options);
4444
var expectedArray = [
4545
' <section class="suite">\n',
4646
' <h1>' + expectedTitle + '</h1>\n',
@@ -49,7 +49,7 @@ describe('Doc reporter', function () {
4949
expect(stdout, 'to equal', expectedArray);
5050
});
5151

52-
it('should escape title where necessary', function () {
52+
it('should escape title where necessary', async function () {
5353
var suite = {
5454
root: false,
5555
title: unescapedTitle
@@ -64,7 +64,7 @@ describe('Doc reporter', function () {
6464
null,
6565
suite
6666
);
67-
var stdout = runReporter(this, runner, options);
67+
var {stdout} = await runReporter({}, runner, options);
6868
var expectedArray = [
6969
' <section class="suite">\n',
7070
' <h1>' + expectedTitle + '</h1>\n',
@@ -79,15 +79,15 @@ describe('Doc reporter', function () {
7979
root: true
8080
};
8181

82-
it('should not log any html', function () {
82+
it('should not log any html', async function () {
8383
runner = createMockRunner(
8484
'suite',
8585
EVENT_SUITE_BEGIN,
8686
null,
8787
null,
8888
suite
8989
);
90-
var stdout = runReporter(this, runner, options);
90+
var {stdout} = await runReporter({}, runner, options);
9191
expect(stdout, 'to be empty');
9292
});
9393
});
@@ -99,15 +99,15 @@ describe('Doc reporter', function () {
9999
root: false
100100
};
101101

102-
it('should log expected html with indents', function () {
102+
it('should log expected html with indents', async function () {
103103
runner = createMockRunner(
104104
'suite end',
105105
EVENT_SUITE_END,
106106
null,
107107
null,
108108
suite
109109
);
110-
var stdout = runReporter(this, runner, options);
110+
var {stdout} = await runReporter({}, runner, options);
111111
var expectedArray = [' </dl>\n', '</section>\n'];
112112
expect(stdout, 'to equal', expectedArray);
113113
});
@@ -118,15 +118,15 @@ describe('Doc reporter', function () {
118118
root: true
119119
};
120120

121-
it('should not log any html', function () {
121+
it('should not log any html', async function () {
122122
runner = createMockRunner(
123123
'suite end',
124124
EVENT_SUITE_END,
125125
null,
126126
null,
127127
suite
128128
);
129-
var stdout = runReporter(this, runner, options);
129+
var {stdout} = await runReporter({}, runner, options);
130130
expect(stdout, 'to be empty');
131131
});
132132
});
@@ -145,9 +145,9 @@ describe('Doc reporter', function () {
145145
}
146146
};
147147

148-
it('should log html with indents, expected title, and body', function () {
148+
it('should log html with indents, expected title, and body', async function () {
149149
runner = createMockRunner('pass', EVENT_TEST_PASS, null, null, test);
150-
var stdout = runReporter(this, runner, options);
150+
var {stdout} = await runReporter({}, runner, options);
151151
var expectedArray = [
152152
' <dt>' + expectedTitle + '</dt>\n',
153153
' <dt>' + expectedFile + '</dt>\n',
@@ -156,7 +156,7 @@ describe('Doc reporter', function () {
156156
expect(stdout, 'to equal', expectedArray);
157157
});
158158

159-
it('should escape title and body where necessary', function () {
159+
it('should escape title and body where necessary', async function () {
160160
var unescapedTitle = '<div>' + expectedTitle + '</div>';
161161
var unescapedFile = '<div>' + expectedFile + '</div>';
162162
var unescapedBody = '<div>' + expectedBody + '</div>';
@@ -171,7 +171,7 @@ describe('Doc reporter', function () {
171171
var expectedEscapedBody =
172172
'&#x3C;div&#x3E;' + expectedBody + '&#x3C;/div&#x3E;';
173173
runner = createMockRunner('pass', EVENT_TEST_PASS, null, null, test);
174-
var stdout = runReporter(this, runner, options);
174+
var {stdout} = await runReporter({}, runner, options);
175175
var expectedArray = [
176176
' <dt>' + expectedEscapedTitle + '</dt>\n',
177177
' <dt>' + expectedEscapedFile + '</dt>\n',
@@ -195,7 +195,7 @@ describe('Doc reporter', function () {
195195
}
196196
};
197197

198-
it('should log html with indents, expected title, body, and error', function () {
198+
it('should log html with indents, expected title, body, and error', async function () {
199199
runner = createMockRunner(
200200
'fail two args',
201201
EVENT_TEST_FAIL,
@@ -204,7 +204,7 @@ describe('Doc reporter', function () {
204204
test,
205205
expectedError
206206
);
207-
var stdout = runReporter(this, runner, options);
207+
var {stdout} = await runReporter({}, runner, options);
208208
var expectedArray = [
209209
' <dt class="error">' + expectedTitle + '</dt>\n',
210210
' <dt class="error">' + expectedFile + '</dt>\n',
@@ -216,7 +216,7 @@ describe('Doc reporter', function () {
216216
expect(stdout, 'to equal', expectedArray);
217217
});
218218

219-
it('should escape title, body, and error where necessary', function () {
219+
it('should escape title, body, and error where necessary', async function () {
220220
var unescapedTitle = '<div>' + expectedTitle + '</div>';
221221
var unescapedFile = '<div>' + expectedFile + '</div>';
222222
var unescapedBody = '<div>' + expectedBody + '</div>';
@@ -241,7 +241,7 @@ describe('Doc reporter', function () {
241241
test,
242242
unescapedError
243243
);
244-
var stdout = runReporter(this, runner, options);
244+
var {stdout} = await runReporter({}, runner, options);
245245
var expectedArray = [
246246
' <dt class="error">' + expectedEscapedTitle + '</dt>\n',
247247
' <dt class="error">' + expectedEscapedFile + '</dt>\n',

0 commit comments

Comments
 (0)