jasmine-core 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/boot/node_boot.js +1 -1
  3. data/lib/jasmine-core/jasmine-html.js +0 -35
  4. data/lib/jasmine-core/jasmine.css +0 -6
  5. data/lib/jasmine-core/jasmine.js +246 -36
  6. data/lib/jasmine-core/node_boot.js +1 -1
  7. data/lib/jasmine-core/version.rb +1 -1
  8. metadata +3 -88
  9. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  10. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  11. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -710
  12. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -286
  13. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  14. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -120
  15. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -46
  16. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  17. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  18. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  19. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  20. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  21. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -332
  22. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -670
  23. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -140
  24. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -407
  25. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -364
  26. data/lib/jasmine-core/spec/core/SpySpec.js +0 -177
  27. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -202
  28. data/lib/jasmine-core/spec/core/StackTraceSpec.js +0 -166
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -123
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  31. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -794
  32. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  33. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -105
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -91
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  38. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -99
  39. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  40. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  41. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -200
  42. data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +0 -138
  43. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2344
  44. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -976
  45. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  46. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  47. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  48. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -645
  49. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  50. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  51. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  52. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  53. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  54. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  55. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  56. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  57. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  58. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  59. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  60. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  61. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  62. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  63. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  64. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  65. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -785
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  67. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  68. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  69. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  70. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  71. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  72. data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +0 -73
  73. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  74. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -15
  75. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  76. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  77. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  78. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  79. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  80. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -6
  81. data/lib/jasmine-core/spec/helpers/integrationMatchers.js +0 -43
  82. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -30
  83. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -1261
  84. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  85. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  86. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -27
  87. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  88. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  89. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -39
  90. data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +0 -48
  91. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  92. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  93. data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,18 +0,0 @@
1
- describe("jasmineUnderTest.HtmlSpecFilter", function() {
2
-
3
- it("should match when no string is provided", function() {
4
- var specFilter = new jasmineUnderTest.HtmlSpecFilter();
5
-
6
- expect(specFilter.matches("foo")).toBe(true);
7
- expect(specFilter.matches("*bar")).toBe(true);
8
- });
9
-
10
- it("should only match the provided string", function() {
11
- var specFilter = new jasmineUnderTest.HtmlSpecFilter({
12
- filterString: function() { return "foo"; }
13
- });
14
-
15
- expect(specFilter.matches("foo")).toBe(true);
16
- expect(specFilter.matches("bar")).toBe(false);
17
- });
18
- });
@@ -1,37 +0,0 @@
1
- describe("MatchersSpec - HTML Dependent", function () {
2
- var env, spec;
3
-
4
- beforeEach(function() {
5
- env = new jasmineUnderTest.Env();
6
-
7
- var suite = env.describe("suite", function() {
8
- spec = env.it("spec", function() {
9
- });
10
- });
11
- spyOn(spec, 'addExpectationResult');
12
-
13
- addMatchers({
14
- toPass: function() {
15
- return lastResult().passed;
16
- },
17
- toFail: function() {
18
- return !lastResult().passed;
19
- }
20
- });
21
- });
22
-
23
- function match(value) {
24
- return spec.expect(value);
25
- }
26
-
27
- function lastResult() {
28
- return spec.addExpectationResult.mostRecentCall.args[1];
29
- }
30
-
31
- xit("toEqual with DOM nodes", function() {
32
- var nodeA = document.createElement('div');
33
- var nodeB = document.createElement('div');
34
- expect((match(nodeA).toEqual(nodeA))).toPass();
35
- expect((match(nodeA).toEqual(nodeB))).toFail();
36
- });
37
- });
@@ -1,27 +0,0 @@
1
- describe("jasmineUnderTest.pp (HTML Dependent)", function () {
2
- it("should stringify non-element HTML nodes properly", function() {
3
- var sampleNode = document.createTextNode("");
4
- expect(jasmineUnderTest.pp(sampleNode)).toEqual("HTMLNode");
5
- expect(jasmineUnderTest.pp({foo: sampleNode})).toEqual("Object({ foo: HTMLNode })");
6
- });
7
-
8
- it("should stringify empty HTML elements as their opening tags", function () {
9
- var simple = document.createElement('div');
10
- simple.className = 'foo';
11
- expect(jasmineUnderTest.pp(simple)).toEqual('<div class="foo">');
12
- });
13
-
14
- it("should stringify non-empty HTML elements as tags with placeholders", function() {
15
- var nonEmpty = document.createElement('div');
16
- nonEmpty.className = 'foo';
17
- nonEmpty.innerHTML = '<p>Irrelevant</p>';
18
- expect(jasmineUnderTest.pp(nonEmpty)).toEqual('<div class="foo">...</div>');
19
- });
20
-
21
- it("should print Firefox's wrapped native objects correctly", function() {
22
- if(jasmine.getEnv().firefoxVersion) {
23
- try { new CustomEvent(); } catch(e) { var err = e; };
24
- expect(jasmineUnderTest.pp(err)).toMatch(/Not enough arguments/);
25
- }
26
- });
27
- });
@@ -1,72 +0,0 @@
1
- describe("QueryString", function() {
2
-
3
- describe("#navigateWithNewParam", function() {
4
- it("sets the query string to include the given key/value pair", function() {
5
- var windowLocation = {
6
- search: ""
7
- },
8
- queryString = new jasmineUnderTest.QueryString({
9
- getWindowLocation: function() { return windowLocation }
10
- });
11
-
12
- queryString.navigateWithNewParam("foo", "bar baz");
13
-
14
- expect(windowLocation.search).toMatch(/foo=bar%20baz/);
15
- });
16
-
17
- it("leaves existing params alone", function() {
18
- var windowLocation = {
19
- search: "?foo=bar"
20
- },
21
- queryString = new jasmineUnderTest.QueryString({
22
- getWindowLocation: function() { return windowLocation }
23
- });
24
-
25
- queryString.navigateWithNewParam("baz", "quux");
26
-
27
- expect(windowLocation.search).toMatch(/foo=bar/);
28
- expect(windowLocation.search).toMatch(/baz=quux/);
29
- });
30
- });
31
-
32
- describe('#fullStringWithNewParam', function() {
33
- it("gets the query string including the given key/value pair", function() {
34
- var windowLocation = {
35
- search: "?foo=bar"
36
- },
37
- queryString = new jasmineUnderTest.QueryString({
38
- getWindowLocation: function() { return windowLocation }
39
- });
40
-
41
- var result = queryString.fullStringWithNewParam("baz", "quux");
42
-
43
- expect(result).toMatch(/foo=bar/);
44
- expect(result).toMatch(/baz=quux/);
45
- });
46
- });
47
-
48
- describe("#getParam", function() {
49
-
50
- it("returns the value of the requested key", function() {
51
- var windowLocation = {
52
- search: "?baz=quux%20corge"
53
- },
54
- queryString = new jasmineUnderTest.QueryString({
55
- getWindowLocation: function() { return windowLocation }
56
- });
57
-
58
- expect(queryString.getParam("baz")).toEqual("quux corge");
59
- });
60
-
61
- it("returns null if the key is not present", function() {
62
- var windowLocation = {
63
- search: ""
64
- },
65
- queryString = new jasmineUnderTest.QueryString({
66
- getWindowLocation: function() { return windowLocation }
67
- });
68
-
69
- expect(queryString.getParam("baz")).toBeFalsy();
70
- });
71
- });
72
- });
@@ -1,62 +0,0 @@
1
- describe("ResultsNode", function() {
2
- it("wraps a result", function() {
3
- var fakeResult = {
4
- id: 123,
5
- message: "foo"
6
- },
7
- node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
8
-
9
- expect(node.result).toBe(fakeResult);
10
- expect(node.type).toEqual("suite");
11
- });
12
-
13
- it("can add children with a type", function() {
14
- var fakeResult = {
15
- id: 123,
16
- message: "foo"
17
- },
18
- fakeChildResult = {
19
- id: 456,
20
- message: "bar"
21
- },
22
- node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
23
-
24
- node.addChild(fakeChildResult, "spec");
25
-
26
- expect(node.children.length).toEqual(1);
27
- expect(node.children[0].result).toEqual(fakeChildResult);
28
- expect(node.children[0].type).toEqual("spec");
29
- });
30
-
31
- it("has a pointer back to its parent ResultNode", function() {
32
- var fakeResult = {
33
- id: 123,
34
- message: "foo"
35
- },
36
- fakeChildResult = {
37
- id: 456,
38
- message: "bar"
39
- },
40
- node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
41
-
42
- node.addChild(fakeChildResult, "spec");
43
-
44
- expect(node.children[0].parent).toBe(node);
45
- });
46
-
47
- it("can provide the most recent child", function() {
48
- var fakeResult = {
49
- id: 123,
50
- message: "foo"
51
- },
52
- fakeChildResult = {
53
- id: 456,
54
- message: "bar"
55
- },
56
- node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
57
-
58
- node.addChild(fakeChildResult, "spec");
59
-
60
- expect(node.last()).toBe(node.children[node.children.length - 1]);
61
- });
62
- });
@@ -1,39 +0,0 @@
1
- describe('Spy Registry browser-specific behavior', function() {
2
- function createSpy(name, originalFn) {
3
- return jasmineUnderTest.Spy(name, originalFn);
4
- }
5
-
6
- it('can spy on and unspy window.onerror', function() {
7
- requireWriteableOnerror();
8
-
9
- var spies = [],
10
- spyRegistry = new jasmineUnderTest.SpyRegistry({
11
- currentSpies: function() { return spies; },
12
- createSpy: createSpy,
13
- global: window
14
- }),
15
- originalHandler = window.onerror;
16
-
17
- try {
18
- spyRegistry.spyOn(window, 'onerror');
19
- spyRegistry.clearSpies();
20
- expect(window.onerror).toBe(originalHandler);
21
- } finally {
22
- window.onerror = originalHandler;
23
- }
24
- });
25
-
26
- function requireWriteableOnerror() {
27
- var descriptor;
28
-
29
- try {
30
- descriptor = Object.getOwnPropertyDescriptor(window, 'onerror');
31
- } catch(e) {
32
- // IE 8 doesn't support `definePropery` on non-DOM nodes
33
- }
34
-
35
- if (descriptor && !(descriptor.writable || descriptor.set)) {
36
- pending('Browser declares window.onerror to be readonly');
37
- }
38
- }
39
- });
@@ -1,48 +0,0 @@
1
- describe('toHaveClass', function() {
2
- it('fails for a DOM element that lacks the expected class', function() {
3
- var matcher = jasmineUnderTest.matchers.toHaveClass(),
4
- result = matcher.compare(document.createElement('div'), 'foo');
5
-
6
- expect(result.pass).toBe(false);
7
- });
8
-
9
- it('passes for a DOM element that has the expected class', function() {
10
- var matcher = jasmineUnderTest.matchers.toHaveClass(),
11
- el = document.createElement('div');
12
-
13
- el.className = 'foo bar baz';
14
-
15
- expect(matcher.compare(el, 'foo').pass).toBe(true);
16
- expect(matcher.compare(el, 'bar').pass).toBe(true);
17
- expect(matcher.compare(el, 'bar').pass).toBe(true);
18
- });
19
-
20
- it('fails for a DOM element that only has other classes', function() {
21
- var matcher = jasmineUnderTest.matchers.toHaveClass(),
22
- el = document.createElement('div');
23
-
24
- el.className = 'foo bar';
25
-
26
- expect(matcher.compare(el, 'fo').pass).toBe(false);
27
- });
28
-
29
- it('throws an exception when actual is not a DOM element', function() {
30
- var matcher = jasmineUnderTest.matchers.toHaveClass();
31
-
32
- expect(function() {
33
- matcher.compare('x', 'foo');
34
- }).toThrowError("'x' is not a DOM element");
35
-
36
- expect(function() {
37
- matcher.compare(undefined, 'foo');
38
- }).toThrowError('undefined is not a DOM element');
39
-
40
- expect(function() {
41
- matcher.compare(document.createTextNode(''), 'foo')
42
- }).toThrowError('HTMLNode is not a DOM element');
43
-
44
- expect(function() {
45
- matcher.compare({classList: ''}, 'foo');
46
- }).toThrowError("Object({ classList: '' }) is not a DOM element");
47
- });
48
- });
@@ -1,101 +0,0 @@
1
- describe('npm package', function() {
2
- var path = require('path'),
3
- temp = require('temp').track(),
4
- fs = require('fs');
5
-
6
- beforeAll(function() {
7
- var shell = require('shelljs'),
8
- pack = shell.exec('npm pack', { silent: true});
9
-
10
- this.tarball = pack.stdout.split('\n')[0];
11
- this.tmpDir = temp.mkdirSync(); // automatically deleted on exit
12
-
13
- var untar = shell.exec('tar -xzf ' + this.tarball + ' -C ' + this.tmpDir, { silent: true });
14
- expect(untar.code).toBe(0);
15
-
16
- this.packagedCore = require(path.join(this.tmpDir, 'package/lib/jasmine-core.js'));
17
- });
18
-
19
- beforeEach(function() {
20
- jasmine.addMatchers({
21
- toExistInPath: function(util, customEquality) {
22
- return {
23
- compare: function(actual, expected) {
24
- var fullPath = path.resolve(expected, actual);
25
- return {
26
- pass: fs.existsSync(fullPath)
27
- };
28
- }
29
- };
30
- }
31
- });
32
- });
33
-
34
- afterAll(function() {
35
- var cleanup = function (parent, fileOrFolder) {
36
- var fullPath = path.join(parent, fileOrFolder);
37
- if (fs.statSync(fullPath).isFile()) {
38
- fs.unlinkSync(fullPath);
39
- } else {
40
- fs.readdirSync(fullPath).forEach(cleanup.bind(null, fullPath));
41
- fs.rmdirSync(fullPath);
42
- }
43
- };
44
-
45
- fs.unlinkSync(this.tarball);
46
- });
47
-
48
- it('has a root path', function() {
49
- expect(this.packagedCore.files.path).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/lib/jasmine-core')));
50
- });
51
-
52
- it('has a bootDir', function() {
53
- expect(this.packagedCore.files.bootDir).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/lib/jasmine-core')));
54
- });
55
-
56
- it('has jsFiles', function() {
57
- expect(this.packagedCore.files.jsFiles).toEqual([
58
- 'jasmine.js',
59
- 'jasmine-html.js',
60
- 'json2.js'
61
- ]);
62
-
63
- var packagedCore = this.packagedCore;
64
- this.packagedCore.files.jsFiles.forEach(function(fileName) {
65
- expect(fileName).toExistInPath(packagedCore.files.path);
66
- });
67
- });
68
-
69
- it('has cssFiles', function() {
70
- expect(this.packagedCore.files.cssFiles).toEqual(['jasmine.css']);
71
-
72
- var packagedCore = this.packagedCore;
73
- this.packagedCore.files.cssFiles.forEach(function(fileName) {
74
- expect(fileName).toExistInPath(packagedCore.files.path);
75
- });
76
- });
77
-
78
- it('has bootFiles', function() {
79
- expect(this.packagedCore.files.bootFiles).toEqual(['boot.js']);
80
- expect(this.packagedCore.files.nodeBootFiles).toEqual(['node_boot.js']);
81
-
82
- var packagedCore = this.packagedCore;
83
- this.packagedCore.files.bootFiles.forEach(function(fileName) {
84
- expect(fileName).toExistInPath(packagedCore.files.bootDir);
85
- });
86
-
87
- var packagedCore = this.packagedCore;
88
- this.packagedCore.files.nodeBootFiles.forEach(function(fileName) {
89
- expect(fileName).toExistInPath(packagedCore.files.bootDir);
90
- });
91
- });
92
-
93
- it('has an imagesDir', function() {
94
- expect(this.packagedCore.files.imagesDir).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/images')));
95
- var images = fs.readdirSync(path.resolve(this.tmpDir, 'package/images'));
96
-
97
- expect(images).toContain('jasmine-horizontal.png');
98
- expect(images).toContain('jasmine-horizontal.svg');
99
- expect(images).toContain('jasmine_favicon.png');
100
- });
101
- });
@@ -1,36 +0,0 @@
1
- describe('Printing a big object', function(){
2
- var bigObject;
3
- function rand(upper) {
4
- return Math.round(upper * Math.random());
5
- }
6
-
7
- function generateObject(level) {
8
- var object = {};
9
-
10
- for (var i = 0; i < 50; i++) {
11
- var decide = rand(2);
12
- switch (decide) {
13
- case 0:
14
- object["cycle" + i] = object;
15
- break;
16
- case 1:
17
- object["number" + i] = rand(100);
18
- break;
19
- case 2:
20
- if (level < 3) {
21
- object["nesting" + i] = generateObject(level + 1);
22
- }
23
- break;
24
- }
25
-
26
- }
27
-
28
- return object;
29
- }
30
-
31
- it('takes a resonable amount of time', function(){
32
- bigObject = generateObject(0);
33
- expect(jasmineUnderTest.pp(bigObject)).toMatch(/cycle/);
34
- });
35
- });
36
-