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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/jasmine-html.js +24 -1
  3. data/lib/jasmine-core/jasmine.css +1 -0
  4. data/lib/jasmine-core/jasmine.js +50 -6
  5. data/lib/jasmine-core/version.rb +1 -1
  6. metadata +3 -84
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  9. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  10. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
  11. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
  12. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  13. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
  14. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
  15. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  16. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  17. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  18. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  19. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  20. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
  21. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
  22. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
  23. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
  24. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
  25. data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
  26. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
  27. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
  28. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  29. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
  30. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  38. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  39. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
  40. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
  41. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
  42. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  43. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  44. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  45. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
  46. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  47. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  48. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  49. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  50. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  51. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  52. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  53. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  54. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  55. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  56. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  57. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  58. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  59. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  60. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  61. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  62. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
  63. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  64. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  65. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  67. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  68. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  69. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  70. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
  71. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  72. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  73. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  74. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  75. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  76. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
  77. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
  78. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
  79. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  80. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  81. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
  82. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  83. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  84. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
  85. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  86. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  87. 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,15 +0,0 @@
1
- describe("jasmineUnderTest.pp (HTML Dependent)", function () {
2
- it("should stringify HTML nodes properly", function() {
3
- var sampleNode = document.createElement('div');
4
- sampleNode.innerHTML = 'foo<b>bar</b>';
5
- expect(jasmineUnderTest.pp(sampleNode)).toEqual("HTMLNode");
6
- expect(jasmineUnderTest.pp({foo: sampleNode})).toEqual("Object({ foo: HTMLNode })");
7
- });
8
-
9
- it("should print Firefox's wrapped native objects correctly", function() {
10
- if(jasmine.getEnv().firefoxVersion) {
11
- try { new CustomEvent(); } catch(e) { var err = e; };
12
- expect(jasmineUnderTest.pp(err)).toMatch(/Not enough arguments/);
13
- }
14
- });
15
- });
@@ -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,34 +0,0 @@
1
- describe('Spy Registry browser-specific behavior', function() {
2
- it('can spy on and unspy window.onerror', function() {
3
- requireWriteableOnerror();
4
-
5
- var spies = [],
6
- spyRegistry = new jasmineUnderTest.SpyRegistry({
7
- currentSpies: function() { return spies; },
8
- global: window
9
- }),
10
- originalHandler = window.onerror;
11
-
12
- try {
13
- spyRegistry.spyOn(window, 'onerror');
14
- spyRegistry.clearSpies();
15
- expect(window.onerror).toBe(originalHandler);
16
- } finally {
17
- window.onerror = originalHandler;
18
- }
19
- });
20
-
21
- function requireWriteableOnerror() {
22
- var descriptor;
23
-
24
- try {
25
- descriptor = Object.getOwnPropertyDescriptor(window, 'onerror');
26
- } catch(e) {
27
- // IE 8 doesn't support `definePropery` on non-DOM nodes
28
- }
29
-
30
- if (descriptor && !(descriptor.writable || descriptor.set)) {
31
- pending('Browser declares window.onerror to be readonly');
32
- }
33
- }
34
- });
@@ -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
-
@@ -1,10 +0,0 @@
1
- describe("performance", function() {
2
- for (var i = 0; i < 10000; i++) {
3
- it("should pass", function() {
4
- expect(true).toBe(true);
5
- });
6
- it("should fail", function() {
7
- expect(true).toBe(false);
8
- });
9
- }
10
- });