jasmine-core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jasmine-core/boot/node_boot.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +0 -35
- data/lib/jasmine-core/jasmine.css +0 -6
- data/lib/jasmine-core/jasmine.js +246 -36
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -88
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
- data/lib/jasmine-core/spec/core/ClockSpec.js +0 -710
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -286
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -120
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -46
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
- data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -332
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -670
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -140
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -407
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -364
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -177
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -202
- data/lib/jasmine-core/spec/core/StackTraceSpec.js +0 -166
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -123
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -794
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -105
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -91
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -200
- data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +0 -138
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2344
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -976
- data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
- data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -645
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -785
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
- data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +0 -73
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -15
- data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
- data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
- data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
- data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
- data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -6
- data/lib/jasmine-core/spec/helpers/integrationMatchers.js +0 -43
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -30
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -1261
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -27
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -39
- data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +0 -48
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
- data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
- data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,73 +0,0 @@
|
|
1
|
-
describe("toThrowMatching", function() {
|
2
|
-
it("throws an error when the actual is not a function", function() {
|
3
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching();
|
4
|
-
|
5
|
-
expect(function() {
|
6
|
-
matcher.compare({}, function() { return true; });
|
7
|
-
}).toThrowError(/Actual is not a Function/);
|
8
|
-
});
|
9
|
-
|
10
|
-
it("throws an error when the expected is not a function", function() {
|
11
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
|
12
|
-
fn = function() {
|
13
|
-
throw new Error("foo");
|
14
|
-
};
|
15
|
-
|
16
|
-
expect(function() {
|
17
|
-
matcher.compare(fn, 1);
|
18
|
-
}).toThrowError(/Predicate is not a Function/);
|
19
|
-
});
|
20
|
-
|
21
|
-
it("fails if actual does not throw at all", function() {
|
22
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
|
23
|
-
fn = function() {
|
24
|
-
return true;
|
25
|
-
},
|
26
|
-
result;
|
27
|
-
|
28
|
-
result = matcher.compare(fn, function() { return true; });
|
29
|
-
|
30
|
-
expect(result.pass).toBe(false);
|
31
|
-
expect(result.message).toEqual("Expected function to throw an exception.");
|
32
|
-
});
|
33
|
-
|
34
|
-
it("fails with the correct message if thrown is a falsy value", function() {
|
35
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
|
36
|
-
fn = function() {
|
37
|
-
throw undefined;
|
38
|
-
},
|
39
|
-
result;
|
40
|
-
|
41
|
-
result = matcher.compare(fn, function() { return false; });
|
42
|
-
expect(result.pass).toBe(false);
|
43
|
-
expect(result.message()).toEqual("Expected function to throw an exception matching a predicate, but it threw undefined.");
|
44
|
-
});
|
45
|
-
|
46
|
-
it("passes if the argument is a function that returns true when called with the error", function() {
|
47
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
|
48
|
-
predicate = function(e) { return e.message === "nope" },
|
49
|
-
fn = function() {
|
50
|
-
throw new TypeError("nope");
|
51
|
-
},
|
52
|
-
result;
|
53
|
-
|
54
|
-
result = matcher.compare(fn, predicate);
|
55
|
-
|
56
|
-
expect(result.pass).toBe(true);
|
57
|
-
expect(result.message).toEqual("Expected function not to throw an exception matching a predicate.");
|
58
|
-
});
|
59
|
-
|
60
|
-
it("fails if the argument is a function that returns false when called with the error", function() {
|
61
|
-
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
|
62
|
-
predicate = function(e) { return e.message === "oh no" },
|
63
|
-
fn = function() {
|
64
|
-
throw new TypeError("nope");
|
65
|
-
},
|
66
|
-
result;
|
67
|
-
|
68
|
-
result = matcher.compare(fn, predicate);
|
69
|
-
|
70
|
-
expect(result.pass).toBe(false);
|
71
|
-
expect(result.message()).toEqual("Expected function to throw an exception matching a predicate, but it threw TypeError with message 'nope'.");
|
72
|
-
});
|
73
|
-
});
|
@@ -1,100 +0,0 @@
|
|
1
|
-
describe("toThrow", function() {
|
2
|
-
|
3
|
-
it("throws an error when the actual is not a function", function() {
|
4
|
-
var matcher = jasmineUnderTest.matchers.toThrow();
|
5
|
-
|
6
|
-
expect(function() {
|
7
|
-
matcher.compare({});
|
8
|
-
matcherComparator({});
|
9
|
-
}).toThrowError(/Actual is not a Function/);
|
10
|
-
});
|
11
|
-
|
12
|
-
it("fails if actual does not throw", function() {
|
13
|
-
var matcher = jasmineUnderTest.matchers.toThrow(),
|
14
|
-
fn = function() {
|
15
|
-
return true;
|
16
|
-
},
|
17
|
-
result;
|
18
|
-
|
19
|
-
result = matcher.compare(fn);
|
20
|
-
|
21
|
-
expect(result.pass).toBe(false);
|
22
|
-
expect(result.message).toEqual("Expected function to throw an exception.");
|
23
|
-
});
|
24
|
-
|
25
|
-
it("passes if it throws but there is no expected", function() {
|
26
|
-
var util = {
|
27
|
-
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
28
|
-
},
|
29
|
-
matcher = jasmineUnderTest.matchers.toThrow(util),
|
30
|
-
fn = function() {
|
31
|
-
throw 5;
|
32
|
-
},
|
33
|
-
result;
|
34
|
-
|
35
|
-
result = matcher.compare(fn);
|
36
|
-
|
37
|
-
expect(result.pass).toBe(true);
|
38
|
-
expect(result.message()).toEqual("Expected function not to throw, but it threw 5.");
|
39
|
-
});
|
40
|
-
|
41
|
-
it("passes even if what is thrown is falsy", function() {
|
42
|
-
var matcher = jasmineUnderTest.matchers.toThrow(),
|
43
|
-
fn = function() {
|
44
|
-
throw undefined;
|
45
|
-
},
|
46
|
-
result;
|
47
|
-
|
48
|
-
result = matcher.compare(fn);
|
49
|
-
expect(result.pass).toBe(true);
|
50
|
-
expect(result.message()).toEqual("Expected function not to throw, but it threw undefined.");
|
51
|
-
});
|
52
|
-
|
53
|
-
it("passes if what is thrown is equivalent to what is expected", function() {
|
54
|
-
var util = {
|
55
|
-
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
56
|
-
},
|
57
|
-
matcher = jasmineUnderTest.matchers.toThrow(util),
|
58
|
-
fn = function() {
|
59
|
-
throw 5;
|
60
|
-
},
|
61
|
-
result;
|
62
|
-
|
63
|
-
result = matcher.compare(fn, 5);
|
64
|
-
|
65
|
-
expect(result.pass).toBe(true);
|
66
|
-
expect(result.message()).toEqual("Expected function not to throw 5.");
|
67
|
-
});
|
68
|
-
|
69
|
-
it("fails if what is thrown is not equivalent to what is expected", function() {
|
70
|
-
var util = {
|
71
|
-
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
72
|
-
},
|
73
|
-
matcher = jasmineUnderTest.matchers.toThrow(util),
|
74
|
-
fn = function() {
|
75
|
-
throw 5;
|
76
|
-
},
|
77
|
-
result;
|
78
|
-
|
79
|
-
result = matcher.compare(fn, "foo");
|
80
|
-
|
81
|
-
expect(result.pass).toBe(false);
|
82
|
-
expect(result.message()).toEqual("Expected function to throw 'foo', but it threw 5.");
|
83
|
-
});
|
84
|
-
|
85
|
-
it("fails if what is thrown is not equivalent to undefined", function() {
|
86
|
-
var util = {
|
87
|
-
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
88
|
-
},
|
89
|
-
matcher = jasmineUnderTest.matchers.toThrow(util),
|
90
|
-
fn = function() {
|
91
|
-
throw 5;
|
92
|
-
},
|
93
|
-
result;
|
94
|
-
|
95
|
-
result = matcher.compare(fn, void 0);
|
96
|
-
|
97
|
-
expect(result.pass).toBe(false);
|
98
|
-
expect(result.message()).toEqual("Expected function to throw undefined, but it threw 5.");
|
99
|
-
});
|
100
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function browserVersion(matchFn) {
|
3
|
-
var userAgent = jasmine.getGlobal().navigator.userAgent;
|
4
|
-
if (!userAgent) { return void 0; }
|
5
|
-
|
6
|
-
var match = matchFn(userAgent);
|
7
|
-
|
8
|
-
return match ? parseFloat(match[1]) : void 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
env.firefoxVersion = browserVersion(function(userAgent) {
|
12
|
-
return /Firefox\/([0-9]{0,})/.exec(userAgent);
|
13
|
-
});
|
14
|
-
|
15
|
-
})(jasmine.getEnv());
|
@@ -1,27 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function getAsyncCtor() {
|
3
|
-
try {
|
4
|
-
eval("var func = async function(){};");
|
5
|
-
} catch (e) {
|
6
|
-
return null;
|
7
|
-
}
|
8
|
-
|
9
|
-
return Object.getPrototypeOf(func).constructor;
|
10
|
-
}
|
11
|
-
|
12
|
-
function hasAsyncAwaitSupport() {
|
13
|
-
return getAsyncCtor() !== null;
|
14
|
-
}
|
15
|
-
|
16
|
-
env.makeAsyncAwaitFunction = function() {
|
17
|
-
var AsyncFunction = getAsyncCtor();
|
18
|
-
return new AsyncFunction("");
|
19
|
-
};
|
20
|
-
|
21
|
-
env.requireAsyncAwait = function() {
|
22
|
-
if (!hasAsyncAwaitSupport()) {
|
23
|
-
env.pending("Environment does not support async/await functions");
|
24
|
-
}
|
25
|
-
};
|
26
|
-
})(jasmine.getEnv());
|
27
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function hasFunctioningMaps() {
|
3
|
-
if (typeof Map === 'undefined') { return false; }
|
4
|
-
|
5
|
-
try {
|
6
|
-
var s = new Map();
|
7
|
-
s.set('a',1);
|
8
|
-
s.set('b',2);
|
9
|
-
|
10
|
-
if (s.size !== 2) { return false; }
|
11
|
-
if (s.has('a') !== true) { return false; }
|
12
|
-
|
13
|
-
var iterations = 0;
|
14
|
-
var ifForEachWorking = true;
|
15
|
-
s.forEach(function(value, key, map) {
|
16
|
-
ifForEachWorking = ifForEachWorking && map === s;
|
17
|
-
if (key==='a') {
|
18
|
-
ifForEachWorking = ifForEachWorking && value===1;
|
19
|
-
}
|
20
|
-
iterations++;
|
21
|
-
});
|
22
|
-
if (iterations !== 2) { return false; }
|
23
|
-
if (ifForEachWorking !== true) { return false; }
|
24
|
-
|
25
|
-
return true;
|
26
|
-
} catch(e) {
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
env.requireFunctioningMaps = function() {
|
32
|
-
if (!hasFunctioningMaps()) {
|
33
|
-
env.pending("Browser has incomplete or missing support for Maps");
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
})(jasmine.getEnv());
|
@@ -1,41 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function hasFunctioningSets() {
|
3
|
-
if (typeof Set === 'undefined') { return false; }
|
4
|
-
|
5
|
-
try {
|
6
|
-
var s = new Set();
|
7
|
-
s.add(1);
|
8
|
-
s.add(2);
|
9
|
-
|
10
|
-
if (s.size !== 2) { return false; }
|
11
|
-
if (s.has(1) !== true) { return false; }
|
12
|
-
|
13
|
-
var iterations = 0;
|
14
|
-
var isForEachWorking = true;
|
15
|
-
s.forEach(function(value, key, set) {
|
16
|
-
isForEachWorking = isForEachWorking && set === s;
|
17
|
-
|
18
|
-
if (iterations===0) {
|
19
|
-
isForEachWorking = isForEachWorking && (key===value) && value===1;
|
20
|
-
} else if (iterations===1) {
|
21
|
-
isForEachWorking = isForEachWorking && (key===value) && value===2;
|
22
|
-
}
|
23
|
-
|
24
|
-
iterations++;
|
25
|
-
});
|
26
|
-
if (iterations !== 2) { return false; }
|
27
|
-
if (isForEachWorking !== true) { return false; }
|
28
|
-
|
29
|
-
return true;
|
30
|
-
} catch(e) {
|
31
|
-
return false;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
env.requireFunctioningSets = function() {
|
36
|
-
if (!hasFunctioningSets()) {
|
37
|
-
env.pending("Browser has incomplete or missing support for Sets");
|
38
|
-
}
|
39
|
-
};
|
40
|
-
|
41
|
-
})(jasmine.getEnv());
|
@@ -1,28 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function hasFunctioningSymbols() {
|
3
|
-
if (typeof Symbol === 'undefined') {
|
4
|
-
return false;
|
5
|
-
}
|
6
|
-
|
7
|
-
try {
|
8
|
-
var s1 = Symbol();
|
9
|
-
var s2 = Symbol();
|
10
|
-
if (typeof s1 !== 'symbol') {
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
if (s1 === s2) {
|
14
|
-
return false;
|
15
|
-
}
|
16
|
-
return true;
|
17
|
-
} catch (e) {
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
env.requireFunctioningSymbols = function() {
|
23
|
-
if (!hasFunctioningSymbols()) {
|
24
|
-
env.pending("Browser has incomplete or missing support for Symbols");
|
25
|
-
}
|
26
|
-
};
|
27
|
-
|
28
|
-
})(jasmine.getEnv());
|
@@ -1,20 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
function hasFunctioningTypedArrays() {
|
3
|
-
if (typeof Uint32Array === 'undefined') { return false; }
|
4
|
-
|
5
|
-
try {
|
6
|
-
var a = new Uint32Array([1, 2, 3]);
|
7
|
-
if (a.length !== 3) { return false; }
|
8
|
-
return true;
|
9
|
-
} catch(e) {
|
10
|
-
return false;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
env.requireFunctioningTypedArrays = function() {
|
15
|
-
if (!hasFunctioningTypedArrays()) {
|
16
|
-
env.pending("Browser has incomplete or missing support for typed arrays");
|
17
|
-
}
|
18
|
-
};
|
19
|
-
|
20
|
-
})(jasmine.getEnv());
|
@@ -1,6 +0,0 @@
|
|
1
|
-
(function() {
|
2
|
-
// By the time onload is called, jasmineRequire will be redefined to point
|
3
|
-
// to the Jasmine source files (and not jasmine.js). So re-require
|
4
|
-
window.jasmineUnderTest = jasmineRequire.core(jasmineRequire);
|
5
|
-
jasmineRequire.html(jasmineUnderTest);
|
6
|
-
})();
|
@@ -1,43 +0,0 @@
|
|
1
|
-
(function(env) {
|
2
|
-
env.registerIntegrationMatchers = function() {
|
3
|
-
jasmine.addMatchers({
|
4
|
-
toHaveFailedExpectationsForRunnable: function (util, customeEqualityTesters) {
|
5
|
-
return {
|
6
|
-
compare: function (actual, fullName, expectedFailures) {
|
7
|
-
var foundRunnable = false, expectations = true, foundFailures = [];
|
8
|
-
for (var i = 0; i < actual.calls.count(); i++) {
|
9
|
-
var args = actual.calls.argsFor(i)[0];
|
10
|
-
|
11
|
-
if (args.fullName === fullName) {
|
12
|
-
foundRunnable = true;
|
13
|
-
|
14
|
-
for (var j = 0; j < args.failedExpectations.length; j++) {
|
15
|
-
foundFailures.push(args.failedExpectations[j].message);
|
16
|
-
}
|
17
|
-
|
18
|
-
for (var j = 0; j < expectedFailures.length; j++) {
|
19
|
-
var failure = foundFailures[j];
|
20
|
-
var expectedFailure = expectedFailures[j];
|
21
|
-
|
22
|
-
if (Object.prototype.toString.call(expectedFailure) === '[object RegExp]') {
|
23
|
-
expectations = expectations && expectedFailure.test(failure);
|
24
|
-
} else {
|
25
|
-
expectations = expectations && failure === expectedFailure;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
break;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
return {
|
33
|
-
pass: foundRunnable && expectations,
|
34
|
-
message: !foundRunnable ? 'The runnable "' + fullName + '" never finished' :
|
35
|
-
'Expected runnable "' + fullName + '" to have failures ' + jasmine.pp(expectedFailures) + ' but it had ' + jasmine.pp(foundFailures)
|
36
|
-
};
|
37
|
-
}
|
38
|
-
};
|
39
|
-
}
|
40
|
-
});
|
41
|
-
};
|
42
|
-
})(jasmine.getEnv());
|
43
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
(function() {
|
2
|
-
var path = require("path"),
|
3
|
-
fs = require("fs");
|
4
|
-
|
5
|
-
var glob = require("glob");
|
6
|
-
|
7
|
-
var jasmineUnderTestRequire = require(path.join(__dirname, "../../src/core/requireCore.js"));
|
8
|
-
|
9
|
-
global.getJasmineRequireObj = function () {
|
10
|
-
return jasmineUnderTestRequire;
|
11
|
-
};
|
12
|
-
|
13
|
-
function extend(destination, source) {
|
14
|
-
for (var property in source) destination[property] = source[property];
|
15
|
-
return destination;
|
16
|
-
}
|
17
|
-
|
18
|
-
function getSourceFiles() {
|
19
|
-
var src_files = ['core/**/*.js', 'version.js'];
|
20
|
-
src_files.forEach(function(file) {
|
21
|
-
var filePath = path.join(__dirname, "../../", 'src/', file);
|
22
|
-
glob.sync(filePath).forEach(function(resolvedFile) {
|
23
|
-
require(resolvedFile);
|
24
|
-
});
|
25
|
-
});
|
26
|
-
}
|
27
|
-
|
28
|
-
getSourceFiles();
|
29
|
-
global.jasmineUnderTest = jasmineUnderTestRequire.core(jasmineUnderTestRequire);
|
30
|
-
})();
|
@@ -1,1261 +0,0 @@
|
|
1
|
-
describe("HtmlReporter", function() {
|
2
|
-
it("builds the initial DOM elements, including the title banner", function() {
|
3
|
-
var env = new jasmineUnderTest.Env(),
|
4
|
-
container = document.createElement("div"),
|
5
|
-
getContainer = function() { return container; },
|
6
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
7
|
-
env: env,
|
8
|
-
getContainer: getContainer,
|
9
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
10
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
11
|
-
});
|
12
|
-
reporter.initialize();
|
13
|
-
|
14
|
-
// Main top-level elements
|
15
|
-
expect(container.querySelector("div.jasmine_html-reporter")).toBeTruthy();
|
16
|
-
expect(container.querySelector("div.jasmine-banner")).toBeTruthy();
|
17
|
-
expect(container.querySelector("div.jasmine-alert")).toBeTruthy();
|
18
|
-
expect(container.querySelector("div.jasmine-results")).toBeTruthy();
|
19
|
-
|
20
|
-
expect(container.querySelector("ul.jasmine-symbol-summary")).toBeTruthy();
|
21
|
-
|
22
|
-
// title banner
|
23
|
-
var banner = container.querySelector(".jasmine-banner");
|
24
|
-
|
25
|
-
var title = banner.querySelector("a.jasmine-title");
|
26
|
-
expect(title.getAttribute('href')).toEqual('http://jasmine.github.io/');
|
27
|
-
expect(title.getAttribute('target')).toEqual('_blank');
|
28
|
-
|
29
|
-
var version = banner.querySelector(".jasmine-version");
|
30
|
-
expect(version.textContent).toEqual(jasmineUnderTest.version);
|
31
|
-
});
|
32
|
-
|
33
|
-
it("builds a single reporter even if initialized multiple times", function() {
|
34
|
-
var env = new jasmineUnderTest.Env(),
|
35
|
-
container = document.createElement("div"),
|
36
|
-
getContainer = function() { return container; },
|
37
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
38
|
-
env: env,
|
39
|
-
getContainer: getContainer,
|
40
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
41
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
42
|
-
});
|
43
|
-
reporter.initialize();
|
44
|
-
reporter.initialize();
|
45
|
-
reporter.initialize();
|
46
|
-
|
47
|
-
expect(container.querySelectorAll("div.jasmine_html-reporter").length).toEqual(1);
|
48
|
-
});
|
49
|
-
|
50
|
-
it("starts the timer when jasmine begins", function() {
|
51
|
-
var env = new jasmine.Env(),
|
52
|
-
startTimerSpy = jasmine.createSpy("start-timer-spy"),
|
53
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
54
|
-
env: env,
|
55
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
56
|
-
timer: { start: startTimerSpy }
|
57
|
-
});
|
58
|
-
|
59
|
-
reporter.jasmineStarted({});
|
60
|
-
|
61
|
-
expect(startTimerSpy).toHaveBeenCalled();
|
62
|
-
});
|
63
|
-
|
64
|
-
describe("when a spec is done", function() {
|
65
|
-
it("logs errors to the console and prints a special symbol if it is an empty spec", function() {
|
66
|
-
if (typeof console === "undefined") {
|
67
|
-
console = { error: function(){} };
|
68
|
-
}
|
69
|
-
|
70
|
-
var env = new jasmineUnderTest.Env(),
|
71
|
-
container = document.createElement('div'),
|
72
|
-
getContainer = function() {return container;},
|
73
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
74
|
-
env: env,
|
75
|
-
getContainer: getContainer,
|
76
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
77
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
78
|
-
});
|
79
|
-
|
80
|
-
spyOn(console, 'error');
|
81
|
-
|
82
|
-
reporter.initialize();
|
83
|
-
|
84
|
-
reporter.specDone({
|
85
|
-
status: "passed",
|
86
|
-
fullName: 'Some Name',
|
87
|
-
passedExpectations: [],
|
88
|
-
failedExpectations: []
|
89
|
-
});
|
90
|
-
expect(console.error).toHaveBeenCalledWith("Spec \'Some Name\' has no expectations.");
|
91
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
92
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-empty");
|
93
|
-
});
|
94
|
-
|
95
|
-
it("reports the status symbol of a excluded spec", function() {
|
96
|
-
var env = new jasmineUnderTest.Env(),
|
97
|
-
container = document.createElement("div"),
|
98
|
-
getContainer = function() { return container; },
|
99
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
100
|
-
env: env,
|
101
|
-
getContainer: getContainer,
|
102
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
103
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
104
|
-
});
|
105
|
-
reporter.initialize();
|
106
|
-
|
107
|
-
reporter.specDone({id: 789, status: "excluded", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
|
108
|
-
|
109
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
110
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-excluded");
|
111
|
-
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
112
|
-
expect(specEl.getAttribute("title")).toEqual("symbols should have titles");
|
113
|
-
});
|
114
|
-
|
115
|
-
it("reports the status symbol of a pending spec", function() {
|
116
|
-
var env = new jasmineUnderTest.Env(),
|
117
|
-
container = document.createElement("div"),
|
118
|
-
getContainer = function() { return container; },
|
119
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
120
|
-
env: env,
|
121
|
-
getContainer: getContainer,
|
122
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
123
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
124
|
-
});
|
125
|
-
reporter.initialize();
|
126
|
-
|
127
|
-
reporter.specDone({id: 789, status: "pending", passedExpectations: [], failedExpectations: []});
|
128
|
-
|
129
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
130
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-pending");
|
131
|
-
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
132
|
-
});
|
133
|
-
|
134
|
-
it("reports the status symbol of a passing spec", function() {
|
135
|
-
var env = new jasmineUnderTest.Env(),
|
136
|
-
container = document.createElement("div"),
|
137
|
-
getContainer = function() { return container; },
|
138
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
139
|
-
env: env,
|
140
|
-
getContainer: getContainer,
|
141
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
142
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
143
|
-
});
|
144
|
-
reporter.initialize();
|
145
|
-
|
146
|
-
reporter.specDone({id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []});
|
147
|
-
|
148
|
-
var statuses = container.querySelector(".jasmine-symbol-summary");
|
149
|
-
var specEl = statuses.querySelector("li");
|
150
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-passed");
|
151
|
-
expect(specEl.getAttribute("id")).toEqual("spec_123");
|
152
|
-
});
|
153
|
-
|
154
|
-
it("reports the status symbol of a failing spec", function() {
|
155
|
-
var env = new jasmineUnderTest.Env(),
|
156
|
-
container = document.createElement("div"),
|
157
|
-
getContainer = function() { return container; },
|
158
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
159
|
-
env: env,
|
160
|
-
getContainer: getContainer,
|
161
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
162
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
163
|
-
});
|
164
|
-
|
165
|
-
reporter.initialize();
|
166
|
-
|
167
|
-
reporter.specDone({
|
168
|
-
id: 345,
|
169
|
-
status: "failed",
|
170
|
-
failedExpectations: [],
|
171
|
-
passedExpectations: []
|
172
|
-
});
|
173
|
-
|
174
|
-
var specEl = container.querySelector(".jasmine-symbol-summary li");
|
175
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-failed");
|
176
|
-
expect(specEl.getAttribute("id")).toEqual("spec_345");
|
177
|
-
});
|
178
|
-
});
|
179
|
-
|
180
|
-
describe('when there are deprecation warnings', function() {
|
181
|
-
it('displays the messages in their own alert bars', function() {
|
182
|
-
var env = new jasmineUnderTest.Env(),
|
183
|
-
container = document.createElement('div'),
|
184
|
-
getContainer = function() { return container; },
|
185
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
186
|
-
env: env,
|
187
|
-
getContainer: getContainer,
|
188
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
189
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
190
|
-
});
|
191
|
-
|
192
|
-
reporter.initialize();
|
193
|
-
|
194
|
-
reporter.jasmineStarted({});
|
195
|
-
reporter.specDone({
|
196
|
-
status: 'passed',
|
197
|
-
deprecationWarnings: [{ message: 'spec deprecation' }],
|
198
|
-
failedExpectations: [],
|
199
|
-
passedExpectations: []
|
200
|
-
});
|
201
|
-
reporter.suiteDone({
|
202
|
-
status: 'passed',
|
203
|
-
deprecationWarnings: [{ message: 'suite deprecation' }],
|
204
|
-
failedExpectations: []
|
205
|
-
});
|
206
|
-
reporter.jasmineDone({
|
207
|
-
deprecationWarnings: [{ message: 'global deprecation' }],
|
208
|
-
failedExpectations: []
|
209
|
-
});
|
210
|
-
|
211
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
212
|
-
|
213
|
-
expect(alertBars.length).toEqual(4);
|
214
|
-
expect(alertBars[1].innerHTML).toMatch(/spec deprecation/);
|
215
|
-
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-warning');
|
216
|
-
expect(alertBars[2].innerHTML).toMatch(/suite deprecation/);
|
217
|
-
expect(alertBars[3].innerHTML).toMatch(/global deprecation/);
|
218
|
-
});
|
219
|
-
});
|
220
|
-
|
221
|
-
describe("when Jasmine is done", function() {
|
222
|
-
it("adds a warning to the link title of specs that have no expectations", function() {
|
223
|
-
if (!window.console) {
|
224
|
-
window.console = { error: function(){} };
|
225
|
-
}
|
226
|
-
var env = new jasmineUnderTest.Env(),
|
227
|
-
container = document.createElement('div'),
|
228
|
-
getContainer = function() {return container;},
|
229
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
230
|
-
env: env,
|
231
|
-
getContainer: getContainer,
|
232
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
233
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
234
|
-
});
|
235
|
-
|
236
|
-
spyOn(console, 'error');
|
237
|
-
|
238
|
-
reporter.initialize();
|
239
|
-
reporter.jasmineStarted({});
|
240
|
-
reporter.suiteStarted({id: 1});
|
241
|
-
reporter.specStarted({id: 1, passedExpectations: [], failedExpectations: []});
|
242
|
-
reporter.specDone({
|
243
|
-
id: 1,
|
244
|
-
status: 'passed',
|
245
|
-
description: 'Spec Description',
|
246
|
-
passedExpectations: [],
|
247
|
-
failedExpectations: []
|
248
|
-
});
|
249
|
-
reporter.suiteDone({id: 1});
|
250
|
-
reporter.jasmineDone({});
|
251
|
-
|
252
|
-
var summary = container.querySelector('.jasmine-summary');
|
253
|
-
var suite = summary.childNodes[0];
|
254
|
-
var specs = suite.childNodes[1];
|
255
|
-
var spec = specs.childNodes[0];
|
256
|
-
var specLink = spec.childNodes[0];
|
257
|
-
expect(specLink.innerHTML).toMatch(/SPEC HAS NO EXPECTATIONS/);
|
258
|
-
});
|
259
|
-
|
260
|
-
it("reports the run time", function() {
|
261
|
-
var env = new jasmineUnderTest.Env(),
|
262
|
-
container = document.createElement("div"),
|
263
|
-
timer = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
264
|
-
getContainer = function() { return container; },
|
265
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
266
|
-
env: env,
|
267
|
-
getContainer: getContainer,
|
268
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
269
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
270
|
-
timer: timer
|
271
|
-
});
|
272
|
-
|
273
|
-
reporter.initialize();
|
274
|
-
|
275
|
-
reporter.jasmineStarted({});
|
276
|
-
|
277
|
-
timer.elapsed.and.returnValue(100);
|
278
|
-
reporter.jasmineDone({});
|
279
|
-
|
280
|
-
var duration = container.querySelector(".jasmine-alert .jasmine-duration");
|
281
|
-
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
282
|
-
});
|
283
|
-
|
284
|
-
it("reports the suite and spec names with status", function() {
|
285
|
-
var env = new jasmineUnderTest.Env(),
|
286
|
-
container = document.createElement("div"),
|
287
|
-
getContainer = function() { return container; },
|
288
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
289
|
-
env: env,
|
290
|
-
getContainer: getContainer,
|
291
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
292
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
293
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
294
|
-
});
|
295
|
-
reporter.initialize();
|
296
|
-
|
297
|
-
reporter.jasmineStarted({});
|
298
|
-
reporter.suiteStarted({
|
299
|
-
id: 1,
|
300
|
-
description: "A Suite",
|
301
|
-
fullName: "A Suite"
|
302
|
-
});
|
303
|
-
|
304
|
-
var specResult = {
|
305
|
-
id: 123,
|
306
|
-
description: "with a spec",
|
307
|
-
fullName: "A Suite with a spec",
|
308
|
-
status: "passed",
|
309
|
-
failedExpectations: [],
|
310
|
-
passedExpectations: [{passed: true}]
|
311
|
-
};
|
312
|
-
reporter.specStarted(specResult);
|
313
|
-
reporter.specDone(specResult);
|
314
|
-
|
315
|
-
reporter.suiteStarted({
|
316
|
-
id: 2,
|
317
|
-
description: "inner suite",
|
318
|
-
fullName: "A Suite inner suite"
|
319
|
-
});
|
320
|
-
|
321
|
-
var specResult = {
|
322
|
-
id: 124,
|
323
|
-
description: "with another spec",
|
324
|
-
fullName: "A Suite inner suite with another spec",
|
325
|
-
status: "passed",
|
326
|
-
failedExpectations: [],
|
327
|
-
passedExpectations: [{passed: true}]
|
328
|
-
};
|
329
|
-
reporter.specStarted(specResult);
|
330
|
-
reporter.specDone(specResult);
|
331
|
-
|
332
|
-
reporter.suiteDone({
|
333
|
-
id: 2,
|
334
|
-
status: 'things',
|
335
|
-
description: "inner suite",
|
336
|
-
fullName: "A Suite inner suite"
|
337
|
-
});
|
338
|
-
|
339
|
-
specResult = {
|
340
|
-
id: 209,
|
341
|
-
description: "with a failing spec",
|
342
|
-
fullName: "A Suite inner with a failing spec",
|
343
|
-
status: "failed",
|
344
|
-
failedExpectations: [{}],
|
345
|
-
passedExpectations: []
|
346
|
-
};
|
347
|
-
reporter.specStarted(specResult);
|
348
|
-
reporter.specDone(specResult);
|
349
|
-
|
350
|
-
reporter.suiteDone({
|
351
|
-
id: 1,
|
352
|
-
status: 'things',
|
353
|
-
description: "A Suite",
|
354
|
-
fullName: "A Suite"
|
355
|
-
});
|
356
|
-
|
357
|
-
reporter.jasmineDone({});
|
358
|
-
var summary = container.querySelector(".jasmine-summary");
|
359
|
-
|
360
|
-
expect(summary.childNodes.length).toEqual(1);
|
361
|
-
|
362
|
-
var outerSuite = summary.childNodes[0];
|
363
|
-
expect(outerSuite.childNodes.length).toEqual(4);
|
364
|
-
|
365
|
-
var classes = [];
|
366
|
-
for (var i = 0; i < outerSuite.childNodes.length; i++) {
|
367
|
-
var node = outerSuite.childNodes[i];
|
368
|
-
classes.push(node.getAttribute("class"));
|
369
|
-
}
|
370
|
-
expect(classes).toEqual(["jasmine-suite-detail jasmine-things", "jasmine-specs", "jasmine-suite", "jasmine-specs"]);
|
371
|
-
|
372
|
-
var suiteDetail = outerSuite.childNodes[0];
|
373
|
-
var suiteLink = suiteDetail.childNodes[0];
|
374
|
-
expect(suiteLink.innerHTML).toEqual("A Suite");
|
375
|
-
expect(suiteLink.getAttribute('href')).toEqual("?foo=bar&spec=A Suite");
|
376
|
-
|
377
|
-
var specs = outerSuite.childNodes[1];
|
378
|
-
var spec = specs.childNodes[0];
|
379
|
-
expect(spec.getAttribute("class")).toEqual("jasmine-passed");
|
380
|
-
expect(spec.getAttribute("id")).toEqual("spec-123");
|
381
|
-
|
382
|
-
var specLink = spec.childNodes[0];
|
383
|
-
expect(specLink.innerHTML).toEqual("with a spec");
|
384
|
-
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=A Suite with a spec");
|
385
|
-
});
|
386
|
-
|
387
|
-
it("has an options menu", function() {
|
388
|
-
var env = new jasmineUnderTest.Env(),
|
389
|
-
container = document.createElement("div"),
|
390
|
-
getContainer = function() {
|
391
|
-
return container;
|
392
|
-
},
|
393
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
394
|
-
env: env,
|
395
|
-
getContainer: getContainer,
|
396
|
-
createElement: function() {
|
397
|
-
return document.createElement.apply(document, arguments);
|
398
|
-
},
|
399
|
-
createTextNode: function() {
|
400
|
-
return document.createTextNode.apply(document, arguments);
|
401
|
-
}
|
402
|
-
});
|
403
|
-
|
404
|
-
reporter.initialize();
|
405
|
-
reporter.jasmineDone({});
|
406
|
-
|
407
|
-
var trigger = container.querySelector('.jasmine-run-options .jasmine-trigger'),
|
408
|
-
payload = container.querySelector('.jasmine-run-options .jasmine-payload');
|
409
|
-
|
410
|
-
expect(payload).not.toHaveClass('jasmine-open');
|
411
|
-
|
412
|
-
trigger.onclick();
|
413
|
-
|
414
|
-
expect(payload).toHaveClass('jasmine-open');
|
415
|
-
|
416
|
-
trigger.onclick();
|
417
|
-
|
418
|
-
expect(payload).not.toHaveClass('jasmine-open');
|
419
|
-
});
|
420
|
-
|
421
|
-
describe("when there are global errors", function() {
|
422
|
-
it("displays the exceptions in their own alert bars", function(){
|
423
|
-
var env = new jasmineUnderTest.Env(),
|
424
|
-
container = document.createElement("div"),
|
425
|
-
getContainer = function() { return container; },
|
426
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
427
|
-
env: env,
|
428
|
-
getContainer: getContainer,
|
429
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
430
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
431
|
-
});
|
432
|
-
|
433
|
-
reporter.initialize();
|
434
|
-
|
435
|
-
reporter.jasmineStarted({});
|
436
|
-
reporter.jasmineDone({ failedExpectations: [
|
437
|
-
{ message: 'Global After All Failure', globalErrorType: 'afterAll' },
|
438
|
-
{ message: 'Your JS is borken', globalErrorType: 'load' }
|
439
|
-
] });
|
440
|
-
|
441
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
442
|
-
|
443
|
-
expect(alertBars.length).toEqual(3);
|
444
|
-
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-errored');
|
445
|
-
expect(alertBars[1].innerHTML).toMatch(/AfterAll Global After All Failure/);
|
446
|
-
expect(alertBars[2].innerHTML).toMatch(/Error during loading: Your JS is borken/);
|
447
|
-
expect(alertBars[2].innerHTML).not.toMatch(/line/);
|
448
|
-
});
|
449
|
-
|
450
|
-
it("displays file and line information if available", function() {
|
451
|
-
var env = new jasmineUnderTest.Env(),
|
452
|
-
container = document.createElement("div"),
|
453
|
-
getContainer = function() { return container; },
|
454
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
455
|
-
env: env,
|
456
|
-
getContainer: getContainer,
|
457
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
458
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
459
|
-
});
|
460
|
-
|
461
|
-
reporter.initialize();
|
462
|
-
|
463
|
-
reporter.jasmineStarted({});
|
464
|
-
reporter.jasmineDone({ failedExpectations: [
|
465
|
-
{
|
466
|
-
message: 'Your JS is borken',
|
467
|
-
globalErrorType: 'load',
|
468
|
-
filename: 'some/file.js',
|
469
|
-
lineno: 42
|
470
|
-
}
|
471
|
-
] });
|
472
|
-
|
473
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
474
|
-
|
475
|
-
expect(alertBars.length).toEqual(2);
|
476
|
-
expect(alertBars[1].innerHTML).toMatch(/Error during loading: Your JS is borken in some\/file.js line 42/);
|
477
|
-
});
|
478
|
-
});
|
479
|
-
|
480
|
-
describe("UI for stop on spec failure", function() {
|
481
|
-
it("should be unchecked for full execution", function() {
|
482
|
-
var env = new jasmineUnderTest.Env(),
|
483
|
-
container = document.createElement("div"),
|
484
|
-
getContainer = function() {
|
485
|
-
return container;
|
486
|
-
},
|
487
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
488
|
-
env: env,
|
489
|
-
getContainer: getContainer,
|
490
|
-
createElement: function() {
|
491
|
-
return document.createElement.apply(document, arguments);
|
492
|
-
},
|
493
|
-
createTextNode: function() {
|
494
|
-
return document.createTextNode.apply(document, arguments);
|
495
|
-
}
|
496
|
-
});
|
497
|
-
|
498
|
-
reporter.initialize();
|
499
|
-
reporter.jasmineDone({});
|
500
|
-
|
501
|
-
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
502
|
-
expect(stopOnFailureUI.checked).toBe(false);
|
503
|
-
});
|
504
|
-
|
505
|
-
it("should be checked if stopping short", function() {
|
506
|
-
var env = new jasmineUnderTest.Env(),
|
507
|
-
container = document.createElement("div"),
|
508
|
-
getContainer = function() {
|
509
|
-
return container;
|
510
|
-
},
|
511
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
512
|
-
env: env,
|
513
|
-
getContainer: getContainer,
|
514
|
-
createElement: function() {
|
515
|
-
return document.createElement.apply(document, arguments);
|
516
|
-
},
|
517
|
-
createTextNode: function() {
|
518
|
-
return document.createTextNode.apply(document, arguments);
|
519
|
-
}
|
520
|
-
});
|
521
|
-
|
522
|
-
env.stopOnSpecFailure(true);
|
523
|
-
|
524
|
-
reporter.initialize();
|
525
|
-
reporter.jasmineDone({});
|
526
|
-
|
527
|
-
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
528
|
-
expect(stopOnFailureUI.checked).toBe(true);
|
529
|
-
});
|
530
|
-
|
531
|
-
it("should navigate and turn the setting on", function() {
|
532
|
-
var env = new jasmineUnderTest.Env(),
|
533
|
-
container = document.createElement("div"),
|
534
|
-
navigationHandler = jasmine.createSpy('navigate'),
|
535
|
-
getContainer = function() {
|
536
|
-
return container;
|
537
|
-
},
|
538
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
539
|
-
env: env,
|
540
|
-
navigateWithNewParam: navigationHandler,
|
541
|
-
getContainer: getContainer,
|
542
|
-
createElement: function() {
|
543
|
-
return document.createElement.apply(document, arguments);
|
544
|
-
},
|
545
|
-
createTextNode: function() {
|
546
|
-
return document.createTextNode.apply(document, arguments);
|
547
|
-
}
|
548
|
-
});
|
549
|
-
|
550
|
-
reporter.initialize();
|
551
|
-
reporter.jasmineDone({});
|
552
|
-
|
553
|
-
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
554
|
-
stopOnFailureUI.click();
|
555
|
-
|
556
|
-
expect(navigationHandler).toHaveBeenCalledWith('failFast', true);
|
557
|
-
});
|
558
|
-
|
559
|
-
it("should navigate and turn the setting off", function() {
|
560
|
-
var env = new jasmineUnderTest.Env(),
|
561
|
-
container = document.createElement("div"),
|
562
|
-
navigationHandler = jasmine.createSpy('navigate'),
|
563
|
-
getContainer = function() {
|
564
|
-
return container;
|
565
|
-
},
|
566
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
567
|
-
env: env,
|
568
|
-
navigateWithNewParam: navigationHandler,
|
569
|
-
getContainer: getContainer,
|
570
|
-
createElement: function() {
|
571
|
-
return document.createElement.apply(document, arguments);
|
572
|
-
},
|
573
|
-
createTextNode: function() {
|
574
|
-
return document.createTextNode.apply(document, arguments);
|
575
|
-
}
|
576
|
-
});
|
577
|
-
|
578
|
-
env.stopOnSpecFailure(true);
|
579
|
-
|
580
|
-
reporter.initialize();
|
581
|
-
reporter.jasmineDone({});
|
582
|
-
|
583
|
-
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
584
|
-
stopOnFailureUI.click();
|
585
|
-
|
586
|
-
expect(navigationHandler).toHaveBeenCalledWith('failFast', false);
|
587
|
-
});
|
588
|
-
});
|
589
|
-
|
590
|
-
describe("UI for throwing errors on expectation failures", function() {
|
591
|
-
it("should be unchecked if not throwing", function() {
|
592
|
-
var env = new jasmineUnderTest.Env(),
|
593
|
-
container = document.createElement("div"),
|
594
|
-
getContainer = function() {
|
595
|
-
return container;
|
596
|
-
},
|
597
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
598
|
-
env: env,
|
599
|
-
getContainer: getContainer,
|
600
|
-
createElement: function() {
|
601
|
-
return document.createElement.apply(document, arguments);
|
602
|
-
},
|
603
|
-
createTextNode: function() {
|
604
|
-
return document.createTextNode.apply(document, arguments);
|
605
|
-
}
|
606
|
-
});
|
607
|
-
|
608
|
-
reporter.initialize();
|
609
|
-
reporter.jasmineDone({});
|
610
|
-
|
611
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
612
|
-
expect(throwingExpectationsUI.checked).toBe(false);
|
613
|
-
});
|
614
|
-
|
615
|
-
it("should be checked if throwing", function() {
|
616
|
-
var env = new jasmineUnderTest.Env(),
|
617
|
-
container = document.createElement("div"),
|
618
|
-
getContainer = function() {
|
619
|
-
return container;
|
620
|
-
},
|
621
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
622
|
-
env: env,
|
623
|
-
getContainer: getContainer,
|
624
|
-
createElement: function() {
|
625
|
-
return document.createElement.apply(document, arguments);
|
626
|
-
},
|
627
|
-
createTextNode: function() {
|
628
|
-
return document.createTextNode.apply(document, arguments);
|
629
|
-
}
|
630
|
-
});
|
631
|
-
|
632
|
-
env.throwOnExpectationFailure(true);
|
633
|
-
|
634
|
-
reporter.initialize();
|
635
|
-
reporter.jasmineDone({});
|
636
|
-
|
637
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
638
|
-
expect(throwingExpectationsUI.checked).toBe(true);
|
639
|
-
});
|
640
|
-
|
641
|
-
it("should navigate and change the setting to on", function() {
|
642
|
-
var env = new jasmineUnderTest.Env(),
|
643
|
-
container = document.createElement("div"),
|
644
|
-
navigateHandler = jasmine.createSpy('navigate'),
|
645
|
-
getContainer = function() {
|
646
|
-
return container;
|
647
|
-
},
|
648
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
649
|
-
env: env,
|
650
|
-
getContainer: getContainer,
|
651
|
-
navigateWithNewParam: navigateHandler,
|
652
|
-
createElement: function() {
|
653
|
-
return document.createElement.apply(document, arguments);
|
654
|
-
},
|
655
|
-
createTextNode: function() {
|
656
|
-
return document.createTextNode.apply(document, arguments);
|
657
|
-
}
|
658
|
-
});
|
659
|
-
|
660
|
-
reporter.initialize();
|
661
|
-
reporter.jasmineDone({});
|
662
|
-
|
663
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
664
|
-
throwingExpectationsUI.click();
|
665
|
-
|
666
|
-
expect(navigateHandler).toHaveBeenCalledWith('throwFailures', true);
|
667
|
-
});
|
668
|
-
|
669
|
-
it("should navigate and change the setting to off", function() {
|
670
|
-
var env = new jasmineUnderTest.Env(),
|
671
|
-
container = document.createElement("div"),
|
672
|
-
navigateHandler = jasmine.createSpy('navigate'),
|
673
|
-
getContainer = function() {
|
674
|
-
return container;
|
675
|
-
},
|
676
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
677
|
-
env: env,
|
678
|
-
getContainer: getContainer,
|
679
|
-
navigateWithNewParam: navigateHandler,
|
680
|
-
createElement: function() {
|
681
|
-
return document.createElement.apply(document, arguments);
|
682
|
-
},
|
683
|
-
createTextNode: function() {
|
684
|
-
return document.createTextNode.apply(document, arguments);
|
685
|
-
}
|
686
|
-
});
|
687
|
-
|
688
|
-
env.throwOnExpectationFailure(true);
|
689
|
-
|
690
|
-
reporter.initialize();
|
691
|
-
reporter.jasmineDone({});
|
692
|
-
|
693
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
694
|
-
throwingExpectationsUI.click();
|
695
|
-
|
696
|
-
expect(navigateHandler).toHaveBeenCalledWith('throwFailures', false);
|
697
|
-
});
|
698
|
-
});
|
699
|
-
|
700
|
-
describe("UI for running tests in random order", function() {
|
701
|
-
it("should be unchecked if not randomizing", function() {
|
702
|
-
var env = new jasmineUnderTest.Env(),
|
703
|
-
container = document.createElement("div"),
|
704
|
-
getContainer = function() {
|
705
|
-
return container;
|
706
|
-
},
|
707
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
708
|
-
env: env,
|
709
|
-
getContainer: getContainer,
|
710
|
-
createElement: function() {
|
711
|
-
return document.createElement.apply(document, arguments);
|
712
|
-
},
|
713
|
-
createTextNode: function() {
|
714
|
-
return document.createTextNode.apply(document, arguments);
|
715
|
-
}
|
716
|
-
});
|
717
|
-
|
718
|
-
env.randomizeTests(false);
|
719
|
-
reporter.initialize();
|
720
|
-
reporter.jasmineDone({});
|
721
|
-
|
722
|
-
var randomUI = container.querySelector(".jasmine-random");
|
723
|
-
expect(randomUI.checked).toBe(false);
|
724
|
-
});
|
725
|
-
|
726
|
-
it("should be checked if randomizing", function() {
|
727
|
-
var env = new jasmineUnderTest.Env(),
|
728
|
-
container = document.createElement("div"),
|
729
|
-
getContainer = function() {
|
730
|
-
return container;
|
731
|
-
},
|
732
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
733
|
-
env: env,
|
734
|
-
getContainer: getContainer,
|
735
|
-
createElement: function() {
|
736
|
-
return document.createElement.apply(document, arguments);
|
737
|
-
},
|
738
|
-
createTextNode: function() {
|
739
|
-
return document.createTextNode.apply(document, arguments);
|
740
|
-
}
|
741
|
-
});
|
742
|
-
|
743
|
-
env.randomizeTests(true);
|
744
|
-
reporter.initialize();
|
745
|
-
reporter.jasmineDone({});
|
746
|
-
|
747
|
-
var randomUI = container.querySelector(".jasmine-random");
|
748
|
-
expect(randomUI.checked).toBe(true);
|
749
|
-
});
|
750
|
-
|
751
|
-
it("should navigate and change the setting to on", function() {
|
752
|
-
var env = new jasmineUnderTest.Env(),
|
753
|
-
container = document.createElement("div"),
|
754
|
-
navigateHandler = jasmine.createSpy('navigate'),
|
755
|
-
getContainer = function() {
|
756
|
-
return container;
|
757
|
-
},
|
758
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
759
|
-
env: env,
|
760
|
-
getContainer: getContainer,
|
761
|
-
navigateWithNewParam: navigateHandler,
|
762
|
-
createElement: function() {
|
763
|
-
return document.createElement.apply(document, arguments);
|
764
|
-
},
|
765
|
-
createTextNode: function() {
|
766
|
-
return document.createTextNode.apply(document, arguments);
|
767
|
-
}
|
768
|
-
});
|
769
|
-
|
770
|
-
env.randomizeTests(false);
|
771
|
-
reporter.initialize();
|
772
|
-
reporter.jasmineDone({});
|
773
|
-
|
774
|
-
var randomUI = container.querySelector(".jasmine-random");
|
775
|
-
randomUI.click();
|
776
|
-
|
777
|
-
expect(navigateHandler).toHaveBeenCalledWith('random', true);
|
778
|
-
});
|
779
|
-
|
780
|
-
it("should navigate and change the setting to off", function() {
|
781
|
-
var env = new jasmineUnderTest.Env(),
|
782
|
-
container = document.createElement("div"),
|
783
|
-
navigateHandler = jasmine.createSpy('navigate'),
|
784
|
-
getContainer = function() {
|
785
|
-
return container;
|
786
|
-
},
|
787
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
788
|
-
env: env,
|
789
|
-
getContainer: getContainer,
|
790
|
-
navigateWithNewParam: navigateHandler,
|
791
|
-
createElement: function() {
|
792
|
-
return document.createElement.apply(document, arguments);
|
793
|
-
},
|
794
|
-
createTextNode: function() {
|
795
|
-
return document.createTextNode.apply(document, arguments);
|
796
|
-
}
|
797
|
-
});
|
798
|
-
|
799
|
-
env.randomizeTests(true);
|
800
|
-
reporter.initialize();
|
801
|
-
reporter.jasmineDone({});
|
802
|
-
|
803
|
-
var randomUI = container.querySelector(".jasmine-random");
|
804
|
-
randomUI.click();
|
805
|
-
|
806
|
-
expect(navigateHandler).toHaveBeenCalledWith('random', false);
|
807
|
-
});
|
808
|
-
|
809
|
-
it("should show the seed bar if randomizing", function() {
|
810
|
-
var env = new jasmineUnderTest.Env(),
|
811
|
-
container = document.createElement("div"),
|
812
|
-
getContainer = function() {
|
813
|
-
return container;
|
814
|
-
},
|
815
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
816
|
-
env: env,
|
817
|
-
getContainer: getContainer,
|
818
|
-
createElement: function() {
|
819
|
-
return document.createElement.apply(document, arguments);
|
820
|
-
},
|
821
|
-
createTextNode: function() {
|
822
|
-
return document.createTextNode.apply(document, arguments);
|
823
|
-
}
|
824
|
-
});
|
825
|
-
|
826
|
-
reporter.initialize();
|
827
|
-
reporter.jasmineDone({
|
828
|
-
order: {
|
829
|
-
random: true,
|
830
|
-
seed: '424242'
|
831
|
-
}
|
832
|
-
});
|
833
|
-
|
834
|
-
var seedBar = container.querySelector(".jasmine-seed-bar");
|
835
|
-
expect(seedBar.textContent).toBe(', randomized with seed 424242');
|
836
|
-
var seedLink = container.querySelector(".jasmine-seed-bar a");
|
837
|
-
expect(seedLink.getAttribute('href')).toBe('?seed=424242');
|
838
|
-
});
|
839
|
-
|
840
|
-
it("should not show the current seed bar if not randomizing", function() {
|
841
|
-
var env = new jasmineUnderTest.Env(),
|
842
|
-
container = document.createElement("div"),
|
843
|
-
getContainer = function() {
|
844
|
-
return container;
|
845
|
-
},
|
846
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
847
|
-
env: env,
|
848
|
-
getContainer: getContainer,
|
849
|
-
createElement: function() {
|
850
|
-
return document.createElement.apply(document, arguments);
|
851
|
-
},
|
852
|
-
createTextNode: function() {
|
853
|
-
return document.createTextNode.apply(document, arguments);
|
854
|
-
}
|
855
|
-
});
|
856
|
-
|
857
|
-
reporter.initialize();
|
858
|
-
reporter.jasmineDone({});
|
859
|
-
|
860
|
-
var seedBar = container.querySelector(".jasmine-seed-bar");
|
861
|
-
expect(seedBar).toBeNull();
|
862
|
-
});
|
863
|
-
|
864
|
-
it("should include non-spec query params in the jasmine-skipped link when present", function(){
|
865
|
-
var env = new jasmineUnderTest.Env(),
|
866
|
-
container = document.createElement("div"),
|
867
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
868
|
-
env: env,
|
869
|
-
getContainer: function() { return container; },
|
870
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
871
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
872
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
873
|
-
});
|
874
|
-
|
875
|
-
reporter.initialize();
|
876
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
877
|
-
reporter.jasmineDone({ order: { random: true } });
|
878
|
-
|
879
|
-
var skippedLink = container.querySelector(".jasmine-skipped a");
|
880
|
-
expect(skippedLink.getAttribute('href')).toEqual('?foo=bar&spec=');
|
881
|
-
});
|
882
|
-
});
|
883
|
-
|
884
|
-
describe("and all specs pass", function() {
|
885
|
-
var env, container, reporter;
|
886
|
-
beforeEach(function() {
|
887
|
-
env = new jasmineUnderTest.Env();
|
888
|
-
container = document.createElement("div");
|
889
|
-
var getContainer = function() { return container; },
|
890
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
891
|
-
env: env,
|
892
|
-
getContainer: getContainer,
|
893
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
894
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
895
|
-
});
|
896
|
-
reporter.initialize();
|
897
|
-
|
898
|
-
reporter.jasmineStarted({ totalSpecsDefined: 2 });
|
899
|
-
reporter.specDone({
|
900
|
-
id: 123,
|
901
|
-
description: "with a spec",
|
902
|
-
fullName: "A Suite with a spec",
|
903
|
-
status: "passed",
|
904
|
-
passedExpectations: [{passed: true}],
|
905
|
-
failedExpectations: []
|
906
|
-
});
|
907
|
-
reporter.specDone({
|
908
|
-
id: 124,
|
909
|
-
description: "with another spec",
|
910
|
-
fullName: "A Suite inner suite with another spec",
|
911
|
-
status: "passed",
|
912
|
-
passedExpectations: [{passed: true}],
|
913
|
-
failedExpectations: []
|
914
|
-
});
|
915
|
-
reporter.jasmineDone({});
|
916
|
-
});
|
917
|
-
|
918
|
-
it("reports the specs counts", function() {
|
919
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
920
|
-
|
921
|
-
expect(alertBars.length).toEqual(1);
|
922
|
-
expect(alertBars[0].innerHTML).toMatch(/2 specs, 0 failures/);
|
923
|
-
});
|
924
|
-
|
925
|
-
it("reports no failure details", function() {
|
926
|
-
var specFailure = container.querySelector(".jasmine-failures");
|
927
|
-
|
928
|
-
expect(specFailure.childNodes.length).toEqual(0);
|
929
|
-
});
|
930
|
-
|
931
|
-
it("reports no pending specs", function() {
|
932
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
933
|
-
|
934
|
-
expect(alertBar.innerHTML).not.toMatch(/pending spec[s]/);
|
935
|
-
});
|
936
|
-
});
|
937
|
-
|
938
|
-
describe("and there are excluded specs", function() {
|
939
|
-
var env, container, reporter, reporterConfig, specStatus;
|
940
|
-
beforeEach(function() {
|
941
|
-
env = new jasmineUnderTest.Env();
|
942
|
-
container = document.createElement("div");
|
943
|
-
reporterConfig = {
|
944
|
-
env: env,
|
945
|
-
getContainer: function() { return container; },
|
946
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
947
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
948
|
-
};
|
949
|
-
specStatus = {
|
950
|
-
id: 123,
|
951
|
-
description: "with a excluded spec",
|
952
|
-
fullName: "A Suite with a excluded spec",
|
953
|
-
status: "excluded",
|
954
|
-
passedExpectations: [],
|
955
|
-
failedExpectations: []
|
956
|
-
};
|
957
|
-
});
|
958
|
-
|
959
|
-
describe("when the specs are not filtered", function() {
|
960
|
-
beforeEach(function() {
|
961
|
-
reporterConfig.filterSpecs = false;
|
962
|
-
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
963
|
-
reporter.initialize();
|
964
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
965
|
-
reporter.specStarted(specStatus);
|
966
|
-
reporter.specDone(specStatus);
|
967
|
-
reporter.jasmineDone({});
|
968
|
-
});
|
969
|
-
|
970
|
-
it("shows the excluded spec in the spec list", function() {
|
971
|
-
var specList = container.querySelector(".jasmine-summary");
|
972
|
-
|
973
|
-
expect(specList.innerHTML).toContain('with a excluded spec');
|
974
|
-
});
|
975
|
-
});
|
976
|
-
|
977
|
-
describe("when the specs are filtered", function() {
|
978
|
-
beforeEach(function() {
|
979
|
-
reporterConfig.filterSpecs = true;
|
980
|
-
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
981
|
-
reporter.initialize();
|
982
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
983
|
-
reporter.specStarted(specStatus);
|
984
|
-
reporter.specDone(specStatus);
|
985
|
-
reporter.jasmineDone({});
|
986
|
-
});
|
987
|
-
|
988
|
-
it("doesn't show the excluded spec in the spec list", function() {
|
989
|
-
var specList = container.querySelector(".jasmine-summary");
|
990
|
-
|
991
|
-
expect(specList.innerHTML).toEqual('');
|
992
|
-
});
|
993
|
-
});
|
994
|
-
});
|
995
|
-
|
996
|
-
describe("and there are pending specs", function() {
|
997
|
-
var env, container, reporter;
|
998
|
-
beforeEach(function() {
|
999
|
-
env = new jasmineUnderTest.Env();
|
1000
|
-
container = document.createElement("div");
|
1001
|
-
var getContainer = function() { return container; };
|
1002
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
1003
|
-
env: env,
|
1004
|
-
getContainer: getContainer,
|
1005
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
1006
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
1007
|
-
});
|
1008
|
-
reporter.initialize();
|
1009
|
-
|
1010
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
1011
|
-
var specStatus = {
|
1012
|
-
id: 123,
|
1013
|
-
description: "with a spec",
|
1014
|
-
fullName: "A Suite with a spec",
|
1015
|
-
status: "pending",
|
1016
|
-
passedExpectations: [],
|
1017
|
-
failedExpectations: [],
|
1018
|
-
pendingReason: "my custom pending reason"
|
1019
|
-
};
|
1020
|
-
reporter.specStarted(specStatus);
|
1021
|
-
reporter.specDone(specStatus);
|
1022
|
-
reporter.jasmineDone({});
|
1023
|
-
});
|
1024
|
-
|
1025
|
-
it("reports the pending specs count", function() {
|
1026
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
1027
|
-
|
1028
|
-
expect(alertBar.innerHTML).toMatch(/1 spec, 0 failures, 1 pending spec/);
|
1029
|
-
});
|
1030
|
-
|
1031
|
-
it("reports no failure details", function() {
|
1032
|
-
var specFailure = container.querySelector(".jasmine-failures");
|
1033
|
-
|
1034
|
-
expect(specFailure.childNodes.length).toEqual(0);
|
1035
|
-
});
|
1036
|
-
|
1037
|
-
it("displays the custom pending reason", function() {
|
1038
|
-
var pendingDetails = container.querySelector(".jasmine-summary .jasmine-pending");
|
1039
|
-
|
1040
|
-
expect(pendingDetails.innerHTML).toContain("my custom pending reason");
|
1041
|
-
});
|
1042
|
-
});
|
1043
|
-
|
1044
|
-
describe("and some tests fail", function() {
|
1045
|
-
var env, container, reporter;
|
1046
|
-
|
1047
|
-
beforeEach(function() {
|
1048
|
-
env = new jasmineUnderTest.Env();
|
1049
|
-
container = document.createElement("div");
|
1050
|
-
var getContainer = function() { return container; }
|
1051
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
1052
|
-
env: env,
|
1053
|
-
getContainer: getContainer,
|
1054
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
1055
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
1056
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
1057
|
-
});
|
1058
|
-
reporter.initialize();
|
1059
|
-
|
1060
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
1061
|
-
reporter.suiteStarted({
|
1062
|
-
id: 1,
|
1063
|
-
description: "A suite"
|
1064
|
-
});
|
1065
|
-
reporter.suiteStarted({
|
1066
|
-
id: 2,
|
1067
|
-
description: "inner suite"
|
1068
|
-
});
|
1069
|
-
|
1070
|
-
var passingSpecResult = {id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []};
|
1071
|
-
reporter.specStarted(passingSpecResult);
|
1072
|
-
reporter.specDone(passingSpecResult);
|
1073
|
-
|
1074
|
-
var failingSpecResult = {
|
1075
|
-
id: 124,
|
1076
|
-
status: "failed",
|
1077
|
-
description: "a failing spec",
|
1078
|
-
fullName: "a suite inner suite a failing spec",
|
1079
|
-
passedExpectations: [],
|
1080
|
-
failedExpectations: [
|
1081
|
-
{
|
1082
|
-
message: "a failure message",
|
1083
|
-
stack: "a stack trace"
|
1084
|
-
}
|
1085
|
-
]
|
1086
|
-
};
|
1087
|
-
|
1088
|
-
var passingSuiteResult = {
|
1089
|
-
id: 1,
|
1090
|
-
description: "A suite"
|
1091
|
-
};
|
1092
|
-
var failingSuiteResult = {
|
1093
|
-
id: 2,
|
1094
|
-
description: 'a suite',
|
1095
|
-
fullName: 'a suite',
|
1096
|
-
status: 'failed',
|
1097
|
-
failedExpectations: [{ message: 'My After All Exception' }]
|
1098
|
-
};
|
1099
|
-
reporter.specStarted(failingSpecResult);
|
1100
|
-
reporter.specDone(failingSpecResult);
|
1101
|
-
reporter.suiteDone(passingSuiteResult);
|
1102
|
-
reporter.suiteDone(failingSuiteResult);
|
1103
|
-
reporter.suiteDone(passingSuiteResult);
|
1104
|
-
reporter.jasmineDone({});
|
1105
|
-
});
|
1106
|
-
|
1107
|
-
it("reports the specs counts", function() {
|
1108
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
1109
|
-
expect(alertBar.innerHTML).toMatch(/2 specs, 2 failure/);
|
1110
|
-
});
|
1111
|
-
|
1112
|
-
it("reports failure messages and stack traces", function() {
|
1113
|
-
var specFailures = container.querySelector(".jasmine-failures");
|
1114
|
-
|
1115
|
-
expect(specFailures.childNodes.length).toEqual(2);
|
1116
|
-
|
1117
|
-
var specFailure = specFailures.childNodes[0];
|
1118
|
-
expect(specFailure.getAttribute("class")).toMatch(/jasmine-failed/);
|
1119
|
-
expect(specFailure.getAttribute("class")).toMatch(/jasmine-spec-detail/);
|
1120
|
-
|
1121
|
-
var specDiv = specFailure.childNodes[0];
|
1122
|
-
expect(specDiv.getAttribute("class")).toEqual("jasmine-description");
|
1123
|
-
|
1124
|
-
var message = specFailure.childNodes[1].childNodes[0];
|
1125
|
-
expect(message.getAttribute("class")).toEqual("jasmine-result-message");
|
1126
|
-
expect(message.innerHTML).toEqual("a failure message");
|
1127
|
-
|
1128
|
-
var stackTrace = specFailure.childNodes[1].childNodes[1];
|
1129
|
-
expect(stackTrace.getAttribute("class")).toEqual("jasmine-stack-trace");
|
1130
|
-
expect(stackTrace.innerHTML).toEqual("a stack trace");
|
1131
|
-
|
1132
|
-
var suiteFailure = specFailures.childNodes[0];
|
1133
|
-
expect(suiteFailure.getAttribute("class")).toMatch(/jasmine-failed/);
|
1134
|
-
expect(suiteFailure.getAttribute("class")).toMatch(/jasmine-spec-detail/);
|
1135
|
-
|
1136
|
-
var suiteDiv = suiteFailure.childNodes[0];
|
1137
|
-
expect(suiteDiv.getAttribute("class")).toEqual("jasmine-description");
|
1138
|
-
|
1139
|
-
var suiteMessage = suiteFailure.childNodes[1].childNodes[0];
|
1140
|
-
expect(suiteMessage.getAttribute("class")).toEqual("jasmine-result-message");
|
1141
|
-
expect(suiteMessage.innerHTML).toEqual("a failure message");
|
1142
|
-
|
1143
|
-
var suiteStackTrace = suiteFailure.childNodes[1].childNodes[1];
|
1144
|
-
expect(suiteStackTrace.getAttribute("class")).toEqual("jasmine-stack-trace");
|
1145
|
-
expect(suiteStackTrace.innerHTML).toEqual("a stack trace");
|
1146
|
-
});
|
1147
|
-
|
1148
|
-
it('provides links to focus on a failure and each containing suite', function() {
|
1149
|
-
var description = container.querySelector('.jasmine-failures .jasmine-description');
|
1150
|
-
var links = description.querySelectorAll('a');
|
1151
|
-
|
1152
|
-
expect(description.textContent).toEqual('A suite > inner suite > a failing spec');
|
1153
|
-
|
1154
|
-
expect(links.length).toEqual(3);
|
1155
|
-
expect(links[0].textContent).toEqual('A suite');
|
1156
|
-
|
1157
|
-
expect(links[0].getAttribute('href')).toMatch(/\?foo=bar&spec=A suite/);
|
1158
|
-
|
1159
|
-
expect(links[1].textContent).toEqual('inner suite');
|
1160
|
-
expect(links[1].getAttribute('href')).toMatch(/\?foo=bar&spec=A suite inner suite/);
|
1161
|
-
|
1162
|
-
expect(links[2].textContent).toEqual('a failing spec');
|
1163
|
-
expect(links[2].getAttribute('href')).toMatch(/\?foo=bar&spec=a suite inner suite a failing spec/);
|
1164
|
-
});
|
1165
|
-
|
1166
|
-
it("allows switching between failure details and the spec summary", function() {
|
1167
|
-
var menuBar = container.querySelectorAll(".jasmine-bar")[1];
|
1168
|
-
|
1169
|
-
expect(menuBar.getAttribute("class")).not.toMatch(/hidden/);
|
1170
|
-
|
1171
|
-
var link = menuBar.querySelector('a');
|
1172
|
-
expect(link.innerHTML).toEqual("Failures");
|
1173
|
-
expect(link.getAttribute("href")).toEqual("#");
|
1174
|
-
});
|
1175
|
-
|
1176
|
-
it("sets the reporter to 'Failures List' mode", function() {
|
1177
|
-
var reporterNode = container.querySelector(".jasmine_html-reporter");
|
1178
|
-
expect(reporterNode.getAttribute("class")).toMatch("jasmine-failure-list");
|
1179
|
-
});
|
1180
|
-
});
|
1181
|
-
});
|
1182
|
-
|
1183
|
-
describe("The overall result bar", function() {
|
1184
|
-
describe("When the jasmineDone event's overallStatus is 'passed'", function() {
|
1185
|
-
it("has class jasmine-passed", function() {
|
1186
|
-
var env = new jasmineUnderTest.Env(),
|
1187
|
-
container = document.createElement("div"),
|
1188
|
-
getContainer = function() { return container; },
|
1189
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
1190
|
-
env: env,
|
1191
|
-
getContainer: getContainer,
|
1192
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
1193
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
1194
|
-
});
|
1195
|
-
|
1196
|
-
reporter.initialize();
|
1197
|
-
|
1198
|
-
reporter.jasmineStarted({});
|
1199
|
-
reporter.jasmineDone({
|
1200
|
-
overallStatus: 'passed',
|
1201
|
-
failedExpectations: []
|
1202
|
-
});
|
1203
|
-
|
1204
|
-
var alertBar = container.querySelector(".jasmine-overall-result");
|
1205
|
-
expect(alertBar).toHaveClass("jasmine-passed");
|
1206
|
-
});
|
1207
|
-
});
|
1208
|
-
|
1209
|
-
describe("When the jasmineDone event's overallStatus is 'failed'", function() {
|
1210
|
-
it("has class jasmine-failed", function() {
|
1211
|
-
var env = new jasmineUnderTest.Env(),
|
1212
|
-
container = document.createElement("div"),
|
1213
|
-
getContainer = function() { return container; },
|
1214
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
1215
|
-
env: env,
|
1216
|
-
getContainer: getContainer,
|
1217
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
1218
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
1219
|
-
});
|
1220
|
-
|
1221
|
-
reporter.initialize();
|
1222
|
-
|
1223
|
-
reporter.jasmineStarted({});
|
1224
|
-
reporter.jasmineDone({
|
1225
|
-
overallStatus: 'failed',
|
1226
|
-
failedExpectations: []
|
1227
|
-
});
|
1228
|
-
|
1229
|
-
var alertBar = container.querySelector(".jasmine-overall-result");
|
1230
|
-
expect(alertBar).toHaveClass("jasmine-failed");
|
1231
|
-
});
|
1232
|
-
});
|
1233
|
-
|
1234
|
-
describe("When the jasmineDone event's overallStatus is 'incomplete'", function() {
|
1235
|
-
it("has class jasmine-incomplete", function() {
|
1236
|
-
var env = new jasmineUnderTest.Env(),
|
1237
|
-
container = document.createElement("div"),
|
1238
|
-
getContainer = function() { return container; },
|
1239
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
1240
|
-
env: env,
|
1241
|
-
getContainer: getContainer,
|
1242
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
1243
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
1244
|
-
});
|
1245
|
-
|
1246
|
-
reporter.initialize();
|
1247
|
-
|
1248
|
-
reporter.jasmineStarted({});
|
1249
|
-
reporter.jasmineDone({
|
1250
|
-
overallStatus: 'incomplete',
|
1251
|
-
incompleteReason: 'because nope',
|
1252
|
-
failedExpectations: []
|
1253
|
-
});
|
1254
|
-
|
1255
|
-
var alertBar = container.querySelector(".jasmine-overall-result");
|
1256
|
-
expect(alertBar).toHaveClass("jasmine-incomplete");
|
1257
|
-
expect(alertBar.textContent).toContain("Incomplete: because nope");
|
1258
|
-
});
|
1259
|
-
});
|
1260
|
-
});
|
1261
|
-
});
|