jasmine-core 2.4.1 → 2.5.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/console/console.js +1 -1
- data/lib/jasmine-core/boot.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +15 -7
- data/lib/jasmine-core/jasmine.js +261 -82
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +16 -16
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +26 -11
- data/lib/jasmine-core/spec/core/ClockSpec.js +61 -42
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +28 -15
- data/lib/jasmine-core/spec/core/EnvSpec.js +8 -8
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +6 -6
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +1 -1
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +8 -8
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +17 -17
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +14 -14
- data/lib/jasmine-core/spec/core/MockDateSpec.js +14 -14
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +65 -56
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +32 -18
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +27 -3
- data/lib/jasmine-core/spec/core/SpecSpec.js +37 -37
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +46 -7
- data/lib/jasmine-core/spec/core/SpySpec.js +11 -11
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +25 -13
- data/lib/jasmine-core/spec/core/SuiteSpec.js +25 -25
- data/lib/jasmine-core/spec/core/TimerSpec.js +2 -2
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +26 -26
- data/lib/jasmine-core/spec/core/UtilSpec.js +12 -12
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +8 -8
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +7 -7
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +6 -6
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +11 -11
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +4 -4
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +2 -2
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +195 -76
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +20 -21
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +164 -114
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +4 -4
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -3
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -4
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +11 -11
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +22 -17
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +11 -10
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +7 -6
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +24 -24
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +9 -8
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +3 -3
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +5 -5
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +95 -59
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +3 -3
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +1 -1
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +4 -4
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +5 -5
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +4 -4
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +2 -2
- data/lib/jasmine-core/spec/performance/large_object_test.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +5 -3
- data/lib/jasmine-core/spec/node_suite.js +0 -195
@@ -1,28 +1,28 @@
|
|
1
|
-
describe("
|
1
|
+
describe("jasmineUnderTest.util", function() {
|
2
2
|
describe("isArray_", function() {
|
3
3
|
it("should return true if the argument is an array", function() {
|
4
|
-
expect(
|
5
|
-
expect(
|
4
|
+
expect(jasmineUnderTest.isArray_([])).toBe(true);
|
5
|
+
expect(jasmineUnderTest.isArray_(['a'])).toBe(true);
|
6
6
|
});
|
7
7
|
|
8
8
|
it("should return false if the argument is not an array", function() {
|
9
|
-
expect(
|
10
|
-
expect(
|
11
|
-
expect(
|
12
|
-
expect(
|
13
|
-
expect(
|
14
|
-
expect(
|
9
|
+
expect(jasmineUnderTest.isArray_(undefined)).toBe(false);
|
10
|
+
expect(jasmineUnderTest.isArray_({})).toBe(false);
|
11
|
+
expect(jasmineUnderTest.isArray_(function() {})).toBe(false);
|
12
|
+
expect(jasmineUnderTest.isArray_('foo')).toBe(false);
|
13
|
+
expect(jasmineUnderTest.isArray_(5)).toBe(false);
|
14
|
+
expect(jasmineUnderTest.isArray_(null)).toBe(false);
|
15
15
|
});
|
16
16
|
});
|
17
17
|
|
18
18
|
describe("isUndefined", function() {
|
19
19
|
it("reports if a variable is defined", function() {
|
20
20
|
var a;
|
21
|
-
expect(
|
22
|
-
expect(
|
21
|
+
expect(jasmineUnderTest.util.isUndefined(a)).toBe(true);
|
22
|
+
expect(jasmineUnderTest.util.isUndefined(undefined)).toBe(true);
|
23
23
|
|
24
24
|
var undefined = "diz be undefined yo";
|
25
|
-
expect(
|
25
|
+
expect(jasmineUnderTest.util.isUndefined(undefined)).toBe(false);
|
26
26
|
});
|
27
27
|
});
|
28
28
|
});
|
@@ -1,43 +1,43 @@
|
|
1
1
|
describe("Any", function() {
|
2
2
|
it("matches a string", function() {
|
3
|
-
var any = new
|
3
|
+
var any = new jasmineUnderTest.Any(String);
|
4
4
|
|
5
5
|
expect(any.asymmetricMatch("foo")).toBe(true);
|
6
6
|
});
|
7
7
|
|
8
8
|
it("matches a number", function() {
|
9
|
-
var any = new
|
9
|
+
var any = new jasmineUnderTest.Any(Number);
|
10
10
|
|
11
11
|
expect(any.asymmetricMatch(1)).toBe(true);
|
12
12
|
});
|
13
13
|
|
14
14
|
it("matches a function", function() {
|
15
|
-
var any = new
|
15
|
+
var any = new jasmineUnderTest.Any(Function);
|
16
16
|
|
17
17
|
expect(any.asymmetricMatch(function(){})).toBe(true);
|
18
18
|
});
|
19
19
|
|
20
20
|
it("matches an Object", function() {
|
21
|
-
var any = new
|
21
|
+
var any = new jasmineUnderTest.Any(Object);
|
22
22
|
|
23
23
|
expect(any.asymmetricMatch({})).toBe(true);
|
24
24
|
});
|
25
25
|
|
26
26
|
it("matches a Boolean", function() {
|
27
|
-
var any = new
|
27
|
+
var any = new jasmineUnderTest.Any(Boolean);
|
28
28
|
|
29
29
|
expect(any.asymmetricMatch(true)).toBe(true);
|
30
30
|
});
|
31
31
|
|
32
32
|
it("matches another constructed object", function() {
|
33
33
|
var Thing = function() {},
|
34
|
-
any = new
|
34
|
+
any = new jasmineUnderTest.Any(Thing);
|
35
35
|
|
36
36
|
expect(any.asymmetricMatch(new Thing())).toBe(true);
|
37
37
|
});
|
38
38
|
|
39
39
|
it("jasmineToString's itself", function() {
|
40
|
-
var any = new
|
40
|
+
var any = new jasmineUnderTest.Any(Number);
|
41
41
|
|
42
42
|
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
43
43
|
});
|
@@ -45,7 +45,7 @@ describe("Any", function() {
|
|
45
45
|
describe("when called without an argument", function() {
|
46
46
|
it("tells the user to pass a constructor or use jasmine.anything()", function() {
|
47
47
|
expect(function() {
|
48
|
-
new
|
48
|
+
new jasmineUnderTest.Any();
|
49
49
|
}).toThrowError(TypeError, /constructor.*anything/);
|
50
50
|
});
|
51
51
|
});
|
@@ -1,43 +1,43 @@
|
|
1
1
|
describe("Anything", function() {
|
2
2
|
it("matches a string", function() {
|
3
|
-
var anything = new
|
3
|
+
var anything = new jasmineUnderTest.Anything();
|
4
4
|
|
5
5
|
expect(anything.asymmetricMatch('foo')).toBe(true);
|
6
6
|
});
|
7
7
|
|
8
8
|
it("matches a number", function() {
|
9
|
-
var anything = new
|
9
|
+
var anything = new jasmineUnderTest.Anything();
|
10
10
|
|
11
11
|
expect(anything.asymmetricMatch(42)).toBe(true);
|
12
12
|
});
|
13
13
|
|
14
14
|
it("matches an object", function() {
|
15
|
-
var anything = new
|
15
|
+
var anything = new jasmineUnderTest.Anything();
|
16
16
|
|
17
17
|
expect(anything.asymmetricMatch({ foo: 'bar' })).toBe(true);
|
18
18
|
});
|
19
19
|
|
20
20
|
it("matches an array", function() {
|
21
|
-
var anything = new
|
21
|
+
var anything = new jasmineUnderTest.Anything();
|
22
22
|
|
23
23
|
expect(anything.asymmetricMatch([1,2,3])).toBe(true);
|
24
24
|
});
|
25
25
|
|
26
26
|
it("doesn't match undefined", function() {
|
27
|
-
var anything = new
|
27
|
+
var anything = new jasmineUnderTest.Anything();
|
28
28
|
|
29
29
|
expect(anything.asymmetricMatch()).toBe(false);
|
30
30
|
expect(anything.asymmetricMatch(undefined)).toBe(false);
|
31
31
|
});
|
32
32
|
|
33
33
|
it("doesn't match null", function() {
|
34
|
-
var anything = new
|
34
|
+
var anything = new jasmineUnderTest.Anything();
|
35
35
|
|
36
36
|
expect(anything.asymmetricMatch(null)).toBe(false);
|
37
37
|
});
|
38
38
|
|
39
39
|
it("jasmineToString's itself", function() {
|
40
|
-
var anything = new
|
40
|
+
var anything = new jasmineUnderTest.Anything();
|
41
41
|
|
42
42
|
expect(anything.jasmineToString()).toEqual("<jasmine.anything>");
|
43
43
|
});
|
@@ -1,12 +1,12 @@
|
|
1
1
|
describe("ArrayContaining", function() {
|
2
2
|
it("matches any actual to an empty array", function() {
|
3
|
-
var containing = new
|
3
|
+
var containing = new jasmineUnderTest.ArrayContaining([]);
|
4
4
|
|
5
5
|
expect(containing.asymmetricMatch("foo")).toBe(true);
|
6
6
|
});
|
7
7
|
|
8
8
|
it("does not work when not passed an array", function() {
|
9
|
-
var containing = new
|
9
|
+
var containing = new jasmineUnderTest.ArrayContaining("foo");
|
10
10
|
|
11
11
|
expect(function() {
|
12
12
|
containing.asymmetricMatch([]);
|
@@ -14,25 +14,25 @@ describe("ArrayContaining", function() {
|
|
14
14
|
});
|
15
15
|
|
16
16
|
it("matches when the item is in the actual", function() {
|
17
|
-
var containing = new
|
17
|
+
var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
|
18
18
|
|
19
19
|
expect(containing.asymmetricMatch(["foo"])).toBe(true);
|
20
20
|
});
|
21
21
|
|
22
22
|
it("matches when additional items are in the actual", function() {
|
23
|
-
var containing = new
|
23
|
+
var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
|
24
24
|
|
25
25
|
expect(containing.asymmetricMatch(["foo", "bar"])).toBe(true);
|
26
26
|
});
|
27
27
|
|
28
28
|
it("does not match when the item is not in the actual", function() {
|
29
|
-
var containing = new
|
29
|
+
var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
|
30
30
|
|
31
31
|
expect(containing.asymmetricMatch(["bar"])).toBe(false);
|
32
32
|
});
|
33
33
|
|
34
34
|
it("jasmineToStrings itself", function() {
|
35
|
-
var containing = new
|
35
|
+
var containing = new jasmineUnderTest.ArrayContaining([]);
|
36
36
|
|
37
37
|
expect(containing.jasmineToString()).toMatch("<jasmine.arrayContaining");
|
38
38
|
});
|
@@ -1,13 +1,13 @@
|
|
1
1
|
describe("ObjectContaining", function() {
|
2
2
|
|
3
3
|
it("matches any actual to an empty object", function() {
|
4
|
-
var containing = new
|
4
|
+
var containing = new jasmineUnderTest.ObjectContaining({});
|
5
5
|
|
6
6
|
expect(containing.asymmetricMatch("foo")).toBe(true);
|
7
7
|
});
|
8
8
|
|
9
9
|
it("does not match an empty object actual", function() {
|
10
|
-
var containing = new
|
10
|
+
var containing = new jasmineUnderTest.ObjectContaining("foo");
|
11
11
|
|
12
12
|
expect(function() {
|
13
13
|
containing.asymmetricMatch({})
|
@@ -15,43 +15,43 @@ describe("ObjectContaining", function() {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
it("matches when the key/value pair is present in the actual", function() {
|
18
|
-
var containing = new
|
18
|
+
var containing = new jasmineUnderTest.ObjectContaining({foo: "fooVal"});
|
19
19
|
|
20
20
|
expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(true);
|
21
21
|
});
|
22
22
|
|
23
23
|
it("does not match when the key/value pair is not present in the actual", function() {
|
24
|
-
var containing = new
|
24
|
+
var containing = new jasmineUnderTest.ObjectContaining({foo: "fooVal"});
|
25
25
|
|
26
26
|
expect(containing.asymmetricMatch({bar: "barVal", quux: "quuxVal"})).toBe(false);
|
27
27
|
});
|
28
28
|
|
29
29
|
it("does not match when the key is present but the value is different in the actual", function() {
|
30
|
-
var containing = new
|
30
|
+
var containing = new jasmineUnderTest.ObjectContaining({foo: "other"});
|
31
31
|
|
32
32
|
expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(false);
|
33
33
|
});
|
34
34
|
|
35
35
|
it("jasmineToString's itself", function() {
|
36
|
-
var containing = new
|
36
|
+
var containing = new jasmineUnderTest.ObjectContaining({});
|
37
37
|
|
38
38
|
expect(containing.jasmineToString()).toMatch("<jasmine.objectContaining");
|
39
39
|
});
|
40
40
|
|
41
41
|
it("matches recursively", function() {
|
42
|
-
var containing = new
|
42
|
+
var containing = new jasmineUnderTest.ObjectContaining({one: new jasmineUnderTest.ObjectContaining({two: {}})});
|
43
43
|
|
44
44
|
expect(containing.asymmetricMatch({one: {two: {}}})).toBe(true);
|
45
45
|
});
|
46
46
|
|
47
47
|
it("matches when key is present with undefined value", function() {
|
48
|
-
var containing = new
|
48
|
+
var containing = new jasmineUnderTest.ObjectContaining({ one: undefined });
|
49
49
|
|
50
50
|
expect(containing.asymmetricMatch({ one: undefined })).toBe(true);
|
51
51
|
});
|
52
52
|
|
53
53
|
it("does not match when key with undefined value is not present", function() {
|
54
|
-
var containing = new
|
54
|
+
var containing = new jasmineUnderTest.ObjectContaining({ one: undefined });
|
55
55
|
|
56
56
|
expect(containing.asymmetricMatch({})).toBe(false);
|
57
57
|
});
|
@@ -60,7 +60,7 @@ describe("ObjectContaining", function() {
|
|
60
60
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
61
61
|
if (jasmine.getEnv().ieVersion < 9) { return; }
|
62
62
|
|
63
|
-
var containing = new
|
63
|
+
var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" });
|
64
64
|
|
65
65
|
var definedPropertyObject = {};
|
66
66
|
Object.defineProperty(definedPropertyObject, "foo", {
|
@@ -70,7 +70,7 @@ describe("ObjectContaining", function() {
|
|
70
70
|
});
|
71
71
|
|
72
72
|
it("matches prototype properties", function(){
|
73
|
-
var containing = new
|
73
|
+
var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" });
|
74
74
|
|
75
75
|
var prototypeObject = {foo: "fooVal"};
|
76
76
|
var obj;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
describe("StringMatching", function() {
|
2
2
|
it("matches a string against a provided regexp", function() {
|
3
|
-
var matcher = new
|
3
|
+
var matcher = new jasmineUnderTest.StringMatching(/foo/);
|
4
4
|
|
5
5
|
expect(matcher.asymmetricMatch('barfoobaz')).toBe(true);
|
6
6
|
expect(matcher.asymmetricMatch('barbaz')).toBe(false);
|
7
7
|
});
|
8
8
|
|
9
9
|
it("matches a string against provided string", function() {
|
10
|
-
var matcher = new
|
10
|
+
var matcher = new jasmineUnderTest.StringMatching('foo');
|
11
11
|
|
12
12
|
expect(matcher.asymmetricMatch('barfoobaz')).toBe(true);
|
13
13
|
expect(matcher.asymmetricMatch('barbaz')).toBe(false);
|
@@ -15,12 +15,12 @@ describe("StringMatching", function() {
|
|
15
15
|
|
16
16
|
it("raises an Error when the expected is not a String or RegExp", function() {
|
17
17
|
expect(function() {
|
18
|
-
new
|
18
|
+
new jasmineUnderTest.StringMatching({});
|
19
19
|
}).toThrowError(/not a String or a RegExp/);
|
20
20
|
});
|
21
21
|
|
22
22
|
it("jasmineToString's itself", function() {
|
23
|
-
var matching = new
|
23
|
+
var matching = new jasmineUnderTest.StringMatching(/^foo/);
|
24
24
|
|
25
25
|
expect(matching.jasmineToString()).toEqual("<jasmine.stringMatching(/^foo/)>");
|
26
26
|
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe('formatErrorMsg', function () {
|
2
|
+
it('should format an error with a domain', function() {
|
3
|
+
var formator = jasmineUnderTest.formatErrorMsg('api');
|
4
|
+
expect(formator('message')).toBe('api : message');
|
5
|
+
expect(formator('message2')).toBe('api : message2');
|
6
|
+
});
|
7
|
+
|
8
|
+
it('should format an error with a domain and usage', function() {
|
9
|
+
var formator = jasmineUnderTest.formatErrorMsg('api', 'with a param');
|
10
|
+
expect(formator('message')).toBe('api : message\nUsage: with a param');
|
11
|
+
expect(formator('message2')).toBe('api : message2\nUsage: with a param');
|
12
|
+
});
|
13
|
+
});
|
@@ -3,7 +3,7 @@ describe("Custom Matchers (Integration)", function() {
|
|
3
3
|
var fakeTimer;
|
4
4
|
|
5
5
|
beforeEach(function() {
|
6
|
-
env = new
|
6
|
+
env = new jasmineUnderTest.Env();
|
7
7
|
});
|
8
8
|
|
9
9
|
it("allows adding more matchers local to a spec", function(done) {
|
@@ -142,7 +142,7 @@ describe("Custom Matchers (Integration)", function() {
|
|
142
142
|
});
|
143
143
|
|
144
144
|
var specExpectations = function() {
|
145
|
-
expect(argumentSpy).toHaveBeenCalledWith(
|
145
|
+
expect(argumentSpy).toHaveBeenCalledWith(jasmineUnderTest.matchersUtil, [customEqualityFn]);
|
146
146
|
};
|
147
147
|
|
148
148
|
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
@@ -41,7 +41,7 @@ describe("Env integration", function() {
|
|
41
41
|
});
|
42
42
|
|
43
43
|
it("Suites execute as expected (no nesting)", function(done) {
|
44
|
-
var env = new
|
44
|
+
var env = new jasmineUnderTest.Env(),
|
45
45
|
calls = [];
|
46
46
|
|
47
47
|
var assertions = function() {
|
@@ -68,7 +68,7 @@ describe("Env integration", function() {
|
|
68
68
|
});
|
69
69
|
|
70
70
|
it("Nested Suites execute as expected", function(done) {
|
71
|
-
var env = new
|
71
|
+
var env = new jasmineUnderTest.Env(),
|
72
72
|
calls = [];
|
73
73
|
|
74
74
|
var assertions = function() {
|
@@ -101,7 +101,7 @@ describe("Env integration", function() {
|
|
101
101
|
});
|
102
102
|
|
103
103
|
it("Multiple top-level Suites execute as expected", function(done) {
|
104
|
-
var env = new
|
104
|
+
var env = new jasmineUnderTest.Env(),
|
105
105
|
calls = [];
|
106
106
|
|
107
107
|
var assertions = function() {
|
@@ -142,7 +142,7 @@ describe("Env integration", function() {
|
|
142
142
|
});
|
143
143
|
|
144
144
|
it('explicitly fails a spec', function(done) {
|
145
|
-
var env = new
|
145
|
+
var env = new jasmineUnderTest.Env(),
|
146
146
|
specDone = jasmine.createSpy('specDone');
|
147
147
|
|
148
148
|
env.addReporter({
|
@@ -204,7 +204,7 @@ describe("Env integration", function() {
|
|
204
204
|
|
205
205
|
|
206
206
|
it("calls associated befores/specs/afters with the same 'this'", function(done) {
|
207
|
-
var env = new
|
207
|
+
var env = new jasmineUnderTest.Env();
|
208
208
|
|
209
209
|
env.addReporter({jasmineDone: done});
|
210
210
|
env.describe("tests", function() {
|
@@ -241,7 +241,7 @@ describe("Env integration", function() {
|
|
241
241
|
});
|
242
242
|
|
243
243
|
it("calls associated befores/its/afters with the same 'this' for an async spec", function(done) {
|
244
|
-
var env = new
|
244
|
+
var env = new jasmineUnderTest.Env();
|
245
245
|
|
246
246
|
env.addReporter({jasmineDone: done});
|
247
247
|
|
@@ -267,7 +267,7 @@ describe("Env integration", function() {
|
|
267
267
|
});
|
268
268
|
|
269
269
|
it("calls associated beforeAlls/afterAlls only once per suite", function(done) {
|
270
|
-
var env = new
|
270
|
+
var env = new jasmineUnderTest.Env(),
|
271
271
|
before = jasmine.createSpy('beforeAll'),
|
272
272
|
after = jasmine.createSpy('afterAll');
|
273
273
|
|
@@ -299,7 +299,7 @@ describe("Env integration", function() {
|
|
299
299
|
});
|
300
300
|
|
301
301
|
it("calls associated beforeAlls/afterAlls only once per suite for async", function(done) {
|
302
|
-
var env = new
|
302
|
+
var env = new jasmineUnderTest.Env(),
|
303
303
|
before = jasmine.createSpy('beforeAll'),
|
304
304
|
after = jasmine.createSpy('afterAll');
|
305
305
|
|
@@ -338,7 +338,7 @@ describe("Env integration", function() {
|
|
338
338
|
});
|
339
339
|
|
340
340
|
it("calls associated beforeAlls/afterAlls with the cascaded 'this'", function(done) {
|
341
|
-
var env = new
|
341
|
+
var env = new jasmineUnderTest.Env();
|
342
342
|
|
343
343
|
env.addReporter({jasmineDone: done});
|
344
344
|
|
@@ -392,7 +392,7 @@ describe("Env integration", function() {
|
|
392
392
|
});
|
393
393
|
|
394
394
|
it("fails all underlying specs when the beforeAll fails", function (done) {
|
395
|
-
var env = new
|
395
|
+
var env = new jasmineUnderTest.Env(),
|
396
396
|
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone" ]);
|
397
397
|
|
398
398
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -431,7 +431,7 @@ describe("Env integration", function() {
|
|
431
431
|
|
432
432
|
describe('suiteDone reporting', function(){
|
433
433
|
it("reports when an afterAll fails an expectation", function(done) {
|
434
|
-
var env = new
|
434
|
+
var env = new jasmineUnderTest.Env(),
|
435
435
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
436
436
|
|
437
437
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -458,35 +458,35 @@ describe("Env integration", function() {
|
|
458
458
|
});
|
459
459
|
|
460
460
|
it("if there are no specs, it still reports correctly", function(done) {
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
reporter.jasmineDone.and.callFake(function() {
|
465
|
-
expect(reporter.suiteDone).toHaveFailedExpecationsForRunnable('outer suite', [
|
466
|
-
'Expected 1 to equal 2.',
|
467
|
-
'Expected 2 to equal 3.'
|
468
|
-
]);
|
469
|
-
done();
|
470
|
-
});
|
461
|
+
var env = new jasmineUnderTest.Env(),
|
462
|
+
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
471
463
|
|
472
|
-
|
464
|
+
reporter.jasmineDone.and.callFake(function() {
|
465
|
+
expect(reporter.suiteDone).toHaveFailedExpecationsForRunnable('outer suite', [
|
466
|
+
'Expected 1 to equal 2.',
|
467
|
+
'Expected 2 to equal 3.'
|
468
|
+
]);
|
469
|
+
done();
|
470
|
+
});
|
473
471
|
|
474
|
-
|
475
|
-
env.describe('inner suite', function() {
|
476
|
-
env.it('spec', function(){ });
|
477
|
-
});
|
472
|
+
env.addReporter(reporter);
|
478
473
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
});
|
474
|
+
env.describe('outer suite', function() {
|
475
|
+
env.describe('inner suite', function() {
|
476
|
+
env.it('spec', function(){ });
|
483
477
|
});
|
484
478
|
|
485
|
-
env.
|
479
|
+
env.afterAll(function() {
|
480
|
+
env.expect(1).toEqual(2);
|
481
|
+
env.expect(2).toEqual(3);
|
482
|
+
});
|
486
483
|
});
|
487
484
|
|
485
|
+
env.execute();
|
486
|
+
});
|
487
|
+
|
488
488
|
it("reports when afterAll throws an exception", function(done) {
|
489
|
-
var env = new
|
489
|
+
var env = new jasmineUnderTest.Env(),
|
490
490
|
error = new Error('After All Exception'),
|
491
491
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
492
492
|
|
@@ -512,7 +512,7 @@ describe("Env integration", function() {
|
|
512
512
|
});
|
513
513
|
|
514
514
|
it("reports when an async afterAll fails an expectation", function(done) {
|
515
|
-
var env = new
|
515
|
+
var env = new jasmineUnderTest.Env(),
|
516
516
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
517
517
|
|
518
518
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -538,7 +538,7 @@ describe("Env integration", function() {
|
|
538
538
|
});
|
539
539
|
|
540
540
|
it("reports when an async afterAll throws an exception", function(done) {
|
541
|
-
var env = new
|
541
|
+
var env = new jasmineUnderTest.Env(),
|
542
542
|
error = new Error('After All Exception'),
|
543
543
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
544
544
|
|
@@ -565,8 +565,55 @@ describe("Env integration", function() {
|
|
565
565
|
});
|
566
566
|
});
|
567
567
|
|
568
|
+
it('cascades expecatation failures in global beforeAll down to children', function(done) {
|
569
|
+
var env = new jasmineUnderTest.Env(),
|
570
|
+
reporter = jasmine.createSpyObj(['specDone', 'jasmineDone']);
|
571
|
+
|
572
|
+
reporter.jasmineDone.and.callFake(function(results) {
|
573
|
+
expect(results.failedExpectations).toEqual([]);
|
574
|
+
expect(reporter.specDone).toHaveFailedExpecationsForRunnable('is a spec', [
|
575
|
+
'Expected 1 to be 0.'
|
576
|
+
]);
|
577
|
+
done();
|
578
|
+
});
|
579
|
+
|
580
|
+
env.beforeAll(function() {
|
581
|
+
env.expect(1).toBe(0);
|
582
|
+
});
|
583
|
+
|
584
|
+
env.it('is a spec', function() {
|
585
|
+
env.expect(true).toBe(true);
|
586
|
+
});
|
587
|
+
|
588
|
+
env.addReporter(reporter);
|
589
|
+
|
590
|
+
env.execute();
|
591
|
+
});
|
592
|
+
|
593
|
+
it('reports expectation failures in global afterAll', function(done) {
|
594
|
+
var env = new jasmineUnderTest.Env(),
|
595
|
+
reporter = jasmine.createSpyObj(['jasmineDone']);
|
596
|
+
|
597
|
+
reporter.jasmineDone.and.callFake(function(results) {
|
598
|
+
expect(results.failedExpectations).toEqual([jasmine.objectContaining({ message: 'Expected 1 to be 0.' })]);
|
599
|
+
done();
|
600
|
+
});
|
601
|
+
|
602
|
+
env.afterAll(function() {
|
603
|
+
env.expect(1).toBe(0);
|
604
|
+
});
|
605
|
+
|
606
|
+
env.it('is a spec', function() {
|
607
|
+
env.expect(true).toBe(true);
|
608
|
+
});
|
609
|
+
|
610
|
+
env.addReporter(reporter);
|
611
|
+
|
612
|
+
env.execute();
|
613
|
+
});
|
614
|
+
|
568
615
|
it("Allows specifying which specs and suites to run", function(done) {
|
569
|
-
var env = new
|
616
|
+
var env = new jasmineUnderTest.Env(),
|
570
617
|
calls = [],
|
571
618
|
suiteCallback = jasmine.createSpy('suite callback'),
|
572
619
|
firstSpec,
|
@@ -602,7 +649,7 @@ describe("Env integration", function() {
|
|
602
649
|
});
|
603
650
|
|
604
651
|
it('runs before and after all functions for runnables provided to .execute()', function(done) {
|
605
|
-
var env = new
|
652
|
+
var env = new jasmineUnderTest.Env(),
|
606
653
|
calls = [],
|
607
654
|
first_spec,
|
608
655
|
second_spec;
|
@@ -638,7 +685,7 @@ describe("Env integration", function() {
|
|
638
685
|
});
|
639
686
|
|
640
687
|
it("Functions can be spied on and have their calls tracked", function (done) {
|
641
|
-
var env = new
|
688
|
+
var env = new jasmineUnderTest.Env();
|
642
689
|
|
643
690
|
var originalFunctionWasCalled = false;
|
644
691
|
var subject = {
|
@@ -677,8 +724,33 @@ describe("Env integration", function() {
|
|
677
724
|
env.execute();
|
678
725
|
});
|
679
726
|
|
727
|
+
it('can be configured to allow respying on functions', function () {
|
728
|
+
var env = new jasmineUnderTest.Env(),
|
729
|
+
foo = {
|
730
|
+
bar: function () {
|
731
|
+
return 1;
|
732
|
+
}
|
733
|
+
};
|
734
|
+
|
735
|
+
env.allowRespy(true);
|
736
|
+
|
737
|
+
env.describe('test suite', function(){
|
738
|
+
env.it('spec 0', function(){
|
739
|
+
env.spyOn(foo,'bar');
|
740
|
+
|
741
|
+
var error = null;
|
742
|
+
|
743
|
+
expect(function() {
|
744
|
+
env.spyOn(foo, 'bar');
|
745
|
+
}).not.toThrow();
|
746
|
+
});
|
747
|
+
});
|
748
|
+
|
749
|
+
env.execute();
|
750
|
+
});
|
751
|
+
|
680
752
|
it('removes all spies added in a spec after the spec is complete', function(done) {
|
681
|
-
var env = new
|
753
|
+
var env = new jasmineUnderTest.Env(),
|
682
754
|
originalFoo = function() {},
|
683
755
|
testObj = {
|
684
756
|
foo: originalFoo
|
@@ -706,7 +778,7 @@ describe("Env integration", function() {
|
|
706
778
|
});
|
707
779
|
|
708
780
|
it('removes all spies added in a suite after the suite is complete', function(done) {
|
709
|
-
var env = new
|
781
|
+
var env = new jasmineUnderTest.Env(),
|
710
782
|
originalFoo = function() {},
|
711
783
|
testObj = {
|
712
784
|
foo: originalFoo
|
@@ -716,17 +788,17 @@ describe("Env integration", function() {
|
|
716
788
|
env.beforeAll(function() { env.spyOn(testObj, 'foo');})
|
717
789
|
|
718
790
|
env.it('spec 0', function() {
|
719
|
-
expect(
|
791
|
+
expect(jasmineUnderTest.isSpy(testObj.foo)).toBe(true);
|
720
792
|
});
|
721
793
|
|
722
794
|
env.it('spec 1', function() {
|
723
|
-
expect(
|
795
|
+
expect(jasmineUnderTest.isSpy(testObj.foo)).toBe(true);
|
724
796
|
});
|
725
797
|
});
|
726
798
|
|
727
799
|
env.describe('another suite', function() {
|
728
800
|
env.it('spec 2', function() {
|
729
|
-
expect(
|
801
|
+
expect(jasmineUnderTest.isSpy(testObj.foo)).toBe(false);
|
730
802
|
});
|
731
803
|
});
|
732
804
|
|
@@ -735,11 +807,36 @@ describe("Env integration", function() {
|
|
735
807
|
env.execute();
|
736
808
|
});
|
737
809
|
|
810
|
+
it('removes a spy from the top suite after the run is complete', function(done) {
|
811
|
+
var env = new jasmineUnderTest.Env(),
|
812
|
+
originalFoo = function() {},
|
813
|
+
testObj = {
|
814
|
+
foo: originalFoo
|
815
|
+
};
|
816
|
+
|
817
|
+
env.beforeAll(function() {
|
818
|
+
env.spyOn(testObj, 'foo');
|
819
|
+
});
|
820
|
+
|
821
|
+
env.it('spec', function() {
|
822
|
+
expect(jasmineUnderTest.isSpy(testObj.foo)).toBe(true);
|
823
|
+
});
|
824
|
+
|
825
|
+
env.addReporter({
|
826
|
+
jasmineDone: function() {
|
827
|
+
expect(jasmineUnderTest.isSpy(testObj.foo)).toBe(false);
|
828
|
+
done();
|
829
|
+
}
|
830
|
+
});
|
831
|
+
|
832
|
+
env.execute();
|
833
|
+
});
|
834
|
+
|
738
835
|
it("Mock clock can be installed and used in tests", function(done) {
|
739
836
|
var globalSetTimeout = jasmine.createSpy('globalSetTimeout'),
|
740
837
|
delayedFunctionForGlobalClock = jasmine.createSpy('delayedFunctionForGlobalClock'),
|
741
838
|
delayedFunctionForMockClock = jasmine.createSpy('delayedFunctionForMockClock'),
|
742
|
-
env = new
|
839
|
+
env = new jasmineUnderTest.Env({global: { setTimeout: globalSetTimeout }});
|
743
840
|
|
744
841
|
var assertions = function() {
|
745
842
|
expect(delayedFunctionForMockClock).toHaveBeenCalled();
|
@@ -769,7 +866,7 @@ describe("Env integration", function() {
|
|
769
866
|
});
|
770
867
|
|
771
868
|
it("should run async specs in order, waiting for them to complete", function(done) {
|
772
|
-
var env = new
|
869
|
+
var env = new jasmineUnderTest.Env(), mutatedVar;
|
773
870
|
|
774
871
|
env.describe("tests", function() {
|
775
872
|
env.beforeEach(function() {
|
@@ -796,17 +893,17 @@ describe("Env integration", function() {
|
|
796
893
|
var originalTimeout;
|
797
894
|
|
798
895
|
beforeEach(function() {
|
799
|
-
originalTimeout =
|
896
|
+
originalTimeout = jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL;
|
800
897
|
jasmine.clock().install();
|
801
898
|
});
|
802
899
|
|
803
900
|
afterEach(function() {
|
804
901
|
jasmine.clock().uninstall();
|
805
|
-
|
902
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
806
903
|
});
|
807
904
|
|
808
905
|
it("should wait a specified interval before failing specs haven't called done yet", function(done) {
|
809
|
-
var env = new
|
906
|
+
var env = new jasmineUnderTest.Env(),
|
810
907
|
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone" ]);
|
811
908
|
|
812
909
|
reporter.specDone.and.callFake(function() {
|
@@ -819,7 +916,7 @@ describe("Env integration", function() {
|
|
819
916
|
});
|
820
917
|
|
821
918
|
env.addReporter(reporter);
|
822
|
-
|
919
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 8414;
|
823
920
|
|
824
921
|
env.it("async spec that doesn't call done", function(underTestCallback) {
|
825
922
|
env.expect(true).toBeTruthy();
|
@@ -830,7 +927,7 @@ describe("Env integration", function() {
|
|
830
927
|
});
|
831
928
|
|
832
929
|
it("should wait a specified interval before failing beforeAll's and their associated specs that haven't called done", function(done) {
|
833
|
-
var env = new
|
930
|
+
var env = new jasmineUnderTest.Env(),
|
834
931
|
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone" ]);
|
835
932
|
|
836
933
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -841,7 +938,7 @@ describe("Env integration", function() {
|
|
841
938
|
});
|
842
939
|
|
843
940
|
env.addReporter(reporter);
|
844
|
-
|
941
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 1290;
|
845
942
|
|
846
943
|
env.beforeAll(function(done) {
|
847
944
|
jasmine.clock().tick(1290);
|
@@ -859,7 +956,7 @@ describe("Env integration", function() {
|
|
859
956
|
});
|
860
957
|
|
861
958
|
it("should not use the mock clock for asynchronous timeouts", function(){
|
862
|
-
var env = new
|
959
|
+
var env = new jasmineUnderTest.Env(),
|
863
960
|
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone" ]),
|
864
961
|
clock = env.clock;
|
865
962
|
|
@@ -869,7 +966,7 @@ describe("Env integration", function() {
|
|
869
966
|
});
|
870
967
|
|
871
968
|
env.addReporter(reporter);
|
872
|
-
|
969
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 5;
|
873
970
|
|
874
971
|
env.beforeAll(function() {
|
875
972
|
clock.install();
|
@@ -889,7 +986,7 @@ describe("Env integration", function() {
|
|
889
986
|
});
|
890
987
|
|
891
988
|
it("should wait the specified interval before reporting an afterAll that fails to call done", function(done) {
|
892
|
-
var env = new
|
989
|
+
var env = new jasmineUnderTest.Env(),
|
893
990
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','suiteDone']);
|
894
991
|
|
895
992
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -900,7 +997,7 @@ describe("Env integration", function() {
|
|
900
997
|
});
|
901
998
|
|
902
999
|
env.addReporter(reporter);
|
903
|
-
|
1000
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 3000;
|
904
1001
|
|
905
1002
|
env.describe('my suite', function() {
|
906
1003
|
env.it('my spec', function() {
|
@@ -916,7 +1013,7 @@ describe("Env integration", function() {
|
|
916
1013
|
});
|
917
1014
|
|
918
1015
|
it('should wait a custom interval before reporting async functions that fail to call done', function(done) {
|
919
|
-
var env = new
|
1016
|
+
var env = new jasmineUnderTest.Env(),
|
920
1017
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone', 'suiteDone', 'specDone']);
|
921
1018
|
|
922
1019
|
reporter.jasmineDone.and.callFake(function() {
|
@@ -944,7 +1041,7 @@ describe("Env integration", function() {
|
|
944
1041
|
});
|
945
1042
|
|
946
1043
|
env.addReporter(reporter);
|
947
|
-
|
1044
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
948
1045
|
|
949
1046
|
env.describe('suite', function() {
|
950
1047
|
env.describe('beforeAll', function() {
|
@@ -993,7 +1090,7 @@ describe("Env integration", function() {
|
|
993
1090
|
});
|
994
1091
|
|
995
1092
|
it('explicitly fails an async spec', function(done) {
|
996
|
-
var env = new
|
1093
|
+
var env = new jasmineUnderTest.Env(),
|
997
1094
|
specDone = jasmine.createSpy('specDone');
|
998
1095
|
|
999
1096
|
env.addReporter({
|
@@ -1066,7 +1163,7 @@ describe("Env integration", function() {
|
|
1066
1163
|
|
1067
1164
|
describe('focused tests', function() {
|
1068
1165
|
it('should only run the focused tests', function(done) {
|
1069
|
-
var env = new
|
1166
|
+
var env = new jasmineUnderTest.Env(),
|
1070
1167
|
calls = [];
|
1071
1168
|
|
1072
1169
|
var assertions = function() {
|
@@ -1090,7 +1187,7 @@ describe("Env integration", function() {
|
|
1090
1187
|
});
|
1091
1188
|
|
1092
1189
|
it('should only run focused suites', function(){
|
1093
|
-
var env = new
|
1190
|
+
var env = new jasmineUnderTest.Env(),
|
1094
1191
|
calls = [];
|
1095
1192
|
|
1096
1193
|
var assertions = function() {
|
@@ -1116,7 +1213,7 @@ describe("Env integration", function() {
|
|
1116
1213
|
});
|
1117
1214
|
|
1118
1215
|
it('should run focused tests inside an xdescribe', function(done) {
|
1119
|
-
var env = new
|
1216
|
+
var env = new jasmineUnderTest.Env(),
|
1120
1217
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1121
1218
|
"jasmineStarted",
|
1122
1219
|
"jasmineDone",
|
@@ -1151,7 +1248,7 @@ describe("Env integration", function() {
|
|
1151
1248
|
});
|
1152
1249
|
|
1153
1250
|
it('should run focused suites inside an xdescribe', function(done) {
|
1154
|
-
var env = new
|
1251
|
+
var env = new jasmineUnderTest.Env(),
|
1155
1252
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1156
1253
|
"jasmineStarted",
|
1157
1254
|
"jasmineDone",
|
@@ -1189,7 +1286,7 @@ describe("Env integration", function() {
|
|
1189
1286
|
});
|
1190
1287
|
|
1191
1288
|
it("should report as expected", function(done) {
|
1192
|
-
var env = new
|
1289
|
+
var env = new jasmineUnderTest.Env(),
|
1193
1290
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1194
1291
|
"jasmineStarted",
|
1195
1292
|
"jasmineDone",
|
@@ -1259,7 +1356,7 @@ describe("Env integration", function() {
|
|
1259
1356
|
});
|
1260
1357
|
|
1261
1358
|
it('should report pending spec messages', function(done) {
|
1262
|
-
var env = new
|
1359
|
+
var env = new jasmineUnderTest.Env(),
|
1263
1360
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1264
1361
|
'specDone',
|
1265
1362
|
'jasmineDone'
|
@@ -1282,8 +1379,30 @@ describe("Env integration", function() {
|
|
1282
1379
|
env.execute();
|
1283
1380
|
});
|
1284
1381
|
|
1382
|
+
it('should report using fallback reporter', function(done) {
|
1383
|
+
var env = new jasmineUnderTest.Env(),
|
1384
|
+
reporter = jasmine.createSpyObj('fakeReporter', [
|
1385
|
+
'specDone',
|
1386
|
+
'jasmineDone'
|
1387
|
+
]);
|
1388
|
+
|
1389
|
+
reporter.jasmineDone.and.callFake(function() {
|
1390
|
+
expect(reporter.specDone).toHaveBeenCalled();
|
1391
|
+
|
1392
|
+
done();
|
1393
|
+
});
|
1394
|
+
|
1395
|
+
env.provideFallbackReporter(reporter);
|
1396
|
+
|
1397
|
+
env.it('will be pending', function() {
|
1398
|
+
env.pending('with a message');
|
1399
|
+
});
|
1400
|
+
|
1401
|
+
env.execute();
|
1402
|
+
});
|
1403
|
+
|
1285
1404
|
it('should report xdescribes as expected', function(done) {
|
1286
|
-
var env = new
|
1405
|
+
var env = new jasmineUnderTest.Env(),
|
1287
1406
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1288
1407
|
"jasmineStarted",
|
1289
1408
|
"jasmineDone",
|
@@ -1301,7 +1420,7 @@ describe("Env integration", function() {
|
|
1301
1420
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'pending' }));
|
1302
1421
|
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({ description: 'xd out', status: 'pending' }));
|
1303
1422
|
expect(reporter.suiteDone.calls.count()).toBe(4);
|
1304
|
-
|
1423
|
+
|
1305
1424
|
done();
|
1306
1425
|
});
|
1307
1426
|
|
@@ -1323,7 +1442,7 @@ describe("Env integration", function() {
|
|
1323
1442
|
});
|
1324
1443
|
|
1325
1444
|
it("should be possible to get full name from a spec", function() {
|
1326
|
-
var env = new
|
1445
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1327
1446
|
topLevelSpec, nestedSpec, doublyNestedSpec;
|
1328
1447
|
|
1329
1448
|
env.describe("my tests", function() {
|
@@ -1345,7 +1464,7 @@ describe("Env integration", function() {
|
|
1345
1464
|
});
|
1346
1465
|
|
1347
1466
|
it("Custom equality testers should be per spec", function(done) {
|
1348
|
-
var env = new
|
1467
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1349
1468
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1350
1469
|
"jasmineDone",
|
1351
1470
|
"specDone"
|
@@ -1378,7 +1497,7 @@ describe("Env integration", function() {
|
|
1378
1497
|
});
|
1379
1498
|
|
1380
1499
|
it("Custom equality testers should be per suite", function(done) {
|
1381
|
-
var env = new
|
1500
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1382
1501
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1383
1502
|
"jasmineDone",
|
1384
1503
|
"specDone"
|
@@ -1420,7 +1539,7 @@ describe("Env integration", function() {
|
|
1420
1539
|
});
|
1421
1540
|
|
1422
1541
|
it("Custom equality testers for toContain should be per spec", function(done) {
|
1423
|
-
var env = new
|
1542
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1424
1543
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1425
1544
|
"jasmineDone",
|
1426
1545
|
"specDone"
|
@@ -1453,7 +1572,7 @@ describe("Env integration", function() {
|
|
1453
1572
|
});
|
1454
1573
|
|
1455
1574
|
it("produces an understandable error message when an 'expect' is used outside of a current spec", function(done) {
|
1456
|
-
var env = new
|
1575
|
+
var env = new jasmineUnderTest.Env();
|
1457
1576
|
|
1458
1577
|
env.describe("A Suite", function() {
|
1459
1578
|
env.it("an async spec that is actually synchronous", function(underTestCallback) {
|
@@ -1467,7 +1586,7 @@ describe("Env integration", function() {
|
|
1467
1586
|
});
|
1468
1587
|
|
1469
1588
|
it("Custom equality testers for toContain should be per suite", function(done) {
|
1470
|
-
var env = new
|
1589
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1471
1590
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
1472
1591
|
"jasmineDone",
|
1473
1592
|
"specDone"
|
@@ -1509,7 +1628,7 @@ describe("Env integration", function() {
|
|
1509
1628
|
});
|
1510
1629
|
|
1511
1630
|
it("Custom matchers should be per spec", function(done) {
|
1512
|
-
var env = new
|
1631
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1513
1632
|
matchers = {
|
1514
1633
|
toFoo: function() {}
|
1515
1634
|
};
|
@@ -1531,7 +1650,7 @@ describe("Env integration", function() {
|
|
1531
1650
|
});
|
1532
1651
|
|
1533
1652
|
it("Custom matchers should be per suite", function(done) {
|
1534
|
-
var env = new
|
1653
|
+
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
|
1535
1654
|
matchers = {
|
1536
1655
|
toFoo: function() {}
|
1537
1656
|
};
|
@@ -1560,7 +1679,7 @@ describe("Env integration", function() {
|
|
1560
1679
|
});
|
1561
1680
|
|
1562
1681
|
it('throws an exception if you try to create a spy outside of a runnable', function (done) {
|
1563
|
-
var env = new
|
1682
|
+
var env = new jasmineUnderTest.Env(),
|
1564
1683
|
obj = {fn: function () {}},
|
1565
1684
|
exception;
|
1566
1685
|
|
@@ -1583,7 +1702,7 @@ describe("Env integration", function() {
|
|
1583
1702
|
});
|
1584
1703
|
|
1585
1704
|
it('throws an exception if you try to add a matcher outside of a runnable', function (done) {
|
1586
|
-
var env = new
|
1705
|
+
var env = new jasmineUnderTest.Env(),
|
1587
1706
|
obj = {fn: function () {}},
|
1588
1707
|
exception;
|
1589
1708
|
|
@@ -1606,7 +1725,7 @@ describe("Env integration", function() {
|
|
1606
1725
|
});
|
1607
1726
|
|
1608
1727
|
it('throws an exception if you try to add a custom equality outside of a runnable', function (done) {
|
1609
|
-
var env = new
|
1728
|
+
var env = new jasmineUnderTest.Env(),
|
1610
1729
|
obj = {fn: function () {}},
|
1611
1730
|
exception;
|
1612
1731
|
|