Skip to content

Commit 13535c6

Browse files
committed
Testing: run also tests for mocha v2.4.5
1 parent b73d6a6 commit 13535c6

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

tests/external-tests.js

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,47 @@ var runnerPath = path.resolve(path.join(__dirname, '..', 'bin', 'cli.js'));
1313
var testHome = path.resolve(__dirname);
1414
process.chdir(testHome);
1515

16+
/**
17+
* Mocha v2.4.5 - to change with another Mocha version or
18+
* something with Mocha tests
19+
*
20+
* index.html - 22 tests, 18 passed, 4 failed -> one test is displayed twice,
21+
* so they are displayed 5 failing tests, but counted only 4
22+
* large.html - 64 tests, 60 passed, 4 failed -> only 2 tests are failing, but
23+
* they are displayed twice
24+
* opts.html - 8 tests, 2 passed, 6 failed -> only 3 tests are failing, but
25+
* they are displayed twice
26+
*
27+
* By "displayed" it is referred the Mocha HTML Reporter.
28+
*
29+
* From the above explanations it is clear that there are some inconsistencies,
30+
* also because Mocha's HTML Reporter counted number of tests does not match
31+
* the number of displyed tests.
32+
*
33+
* The cause is (snippet from Mocha's HTML reporter):
34+
*
35+
* runner.on('fail', function(test) {
36+
* // For type = 'test' its possible that the test failed due to multiple
37+
* // done() calls. So report the issue here.
38+
* if (test.type === 'hook'
39+
* || test.type === 'test') {
40+
* runner.emit('test end', test);
41+
* }
42+
* });
43+
*
44+
* This is why failed tests are displayed twice...
45+
*
46+
* The JsReporters is counting the tests on the "test end" event, that's why
47+
* it is capturing the failing tests twice, in the "index.html" it does not
48+
* capture everything, because there is an async test, which failure is
49+
* triggered after a timeout and the JsReporters is not waiting, because
50+
* it cannot know how much to wait.
51+
*
52+
*
53+
* This been said, the JsReporter MochaAdapter is functioning well, this
54+
* version of Mocha is not reliable and should be changed.
55+
*/
56+
1657
var repositories = [
1758
{
1859
name: 'qunit',
@@ -36,7 +77,7 @@ var repositories = [
3677
failed: 0
3778
}
3879
},
39-
/*{
80+
{
4081
name: 'mocha',
4182
tag: 'v2.4.5',
4283
url: 'https://github.com/mochajs/mocha.git',
@@ -55,11 +96,11 @@ var repositories = [
5596
'test/browser/opts.html'
5697
],
5798
expected_results: {
58-
tests: 89,
99+
tests: 94,
59100
passed: 80,
60-
failed: 9
101+
failed: 14
61102
}
62-
},*/
103+
},
63104
{
64105
name: 'spine',
65106
tag: 'v.1.6.2',

0 commit comments

Comments
 (0)