jasmine-core 2.9.0 → 2.99.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jasmine-core/jasmine-html.js +24 -1
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +50 -6
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -84
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
- 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 -754
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
- 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 -337
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
- 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 -102
- 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 -199
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
- 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 -658
- 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 -804
- 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/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
- 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 -7
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
- 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 -15
- 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 -34
- 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,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,27 +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.ieVersion = browserVersion(function(userAgent) {
|
12
|
-
return /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(userAgent);
|
13
|
-
});
|
14
|
-
|
15
|
-
env.safariVersion = browserVersion(function(userAgent) {
|
16
|
-
return /Safari/.exec(userAgent) && /Version\/([0-9]{0,})/.exec(userAgent);
|
17
|
-
});
|
18
|
-
|
19
|
-
env.firefoxVersion = browserVersion(function(userAgent) {
|
20
|
-
return /Firefox\/([0-9]{0,})/.exec(userAgent);
|
21
|
-
});
|
22
|
-
|
23
|
-
env.phantomVersion = browserVersion(function(userAgent) {
|
24
|
-
return /PhantomJS\/([0-9]{0,})/.exec(userAgent);
|
25
|
-
});
|
26
|
-
|
27
|
-
})(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,7 +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
|
-
jasmineRequire.console(jasmineRequire, jasmineUnderTest);
|
7
|
-
})();
|
@@ -1,33 +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', 'console/**/*.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
|
-
extend(jasmineUnderTestRequire, require(path.join(__dirname,"../../src/console/requireConsole.js")));
|
29
|
-
getSourceFiles();
|
30
|
-
global.jasmineUnderTest = jasmineUnderTestRequire.core(jasmineUnderTestRequire);
|
31
|
-
|
32
|
-
jasmineUnderTestRequire.console(jasmineUnderTestRequire, jasmineUnderTest);
|
33
|
-
})();
|