jasmine-core 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/console/console.js +27 -22
  3. data/lib/jasmine-core.js +2 -0
  4. data/lib/jasmine-core.rb +6 -2
  5. data/lib/jasmine-core/__init__.py +1 -0
  6. data/lib/jasmine-core/boot.js +1 -1
  7. data/lib/jasmine-core/boot/node_boot.js +71 -0
  8. data/lib/jasmine-core/core.py +60 -0
  9. data/lib/jasmine-core/example/node_example/spec/PlayerSpec.js +60 -0
  10. data/lib/jasmine-core/example/node_example/spec/SpecHelper.js +15 -0
  11. data/lib/jasmine-core/example/node_example/src/Player.js +24 -0
  12. data/lib/jasmine-core/example/node_example/src/Song.js +9 -0
  13. data/lib/jasmine-core/jasmine-html.js +104 -73
  14. data/lib/jasmine-core/jasmine.css +58 -54
  15. data/lib/jasmine-core/jasmine.js +368 -254
  16. data/lib/jasmine-core/node_boot.js +93 -0
  17. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +12 -0
  18. data/lib/jasmine-core/spec/core/AnySpec.js +1 -0
  19. data/lib/jasmine-core/spec/core/ClockSpec.js +103 -17
  20. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +1 -1
  21. data/lib/jasmine-core/spec/core/EnvSpec.js +14 -14
  22. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +7 -0
  23. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +2 -2
  24. data/lib/jasmine-core/spec/core/ExpectationSpec.js +34 -0
  25. data/lib/jasmine-core/spec/core/MockDateSpec.js +179 -0
  26. data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +6 -0
  27. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +41 -10
  28. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +130 -31
  29. data/lib/jasmine-core/spec/core/SpecSpec.js +27 -88
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +18 -0
  31. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +20 -2
  32. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +8 -0
  33. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -1
  34. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -2
  35. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -1
  36. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -2
  37. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +2 -1
  38. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +17 -3
  39. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +11 -11
  40. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +5 -5
  41. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +7 -0
  42. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +33 -0
  43. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +155 -35
  44. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +1 -1
  45. data/lib/jasmine-core/spec/performance/large_object_test.js +36 -0
  46. data/lib/jasmine-core/version.rb +1 -1
  47. metadata +34 -23
  48. data/lib/jasmine-core/spec/node_suite.js +0 -187
  49. data/lib/jasmine-core/spec/support/dev_boot.js +0 -124
@@ -1,187 +0,0 @@
1
- var fs = require('fs');
2
- var util = require('util');
3
- var path = require('path');
4
-
5
- // boot code for jasmine
6
- var jasmineRequire = require('../lib/jasmine-core/jasmine.js');
7
- var jasmine = jasmineRequire.core(jasmineRequire);
8
-
9
- var consoleFns = require('../lib/console/console.js');
10
- extend(jasmineRequire, consoleFns);
11
- jasmineRequire.console(jasmineRequire, jasmine);
12
-
13
- var env = jasmine.getEnv();
14
-
15
- var jasmineInterface = {
16
- describe: function(description, specDefinitions) {
17
- return env.describe(description, specDefinitions);
18
- },
19
-
20
- xdescribe: function(description, specDefinitions) {
21
- return env.xdescribe(description, specDefinitions);
22
- },
23
-
24
- it: function(desc, func) {
25
- return env.it(desc, func);
26
- },
27
-
28
- xit: function(desc, func) {
29
- return env.xit(desc, func);
30
- },
31
-
32
- beforeEach: function(beforeEachFunction) {
33
- return env.beforeEach(beforeEachFunction);
34
- },
35
-
36
- afterEach: function(afterEachFunction) {
37
- return env.afterEach(afterEachFunction);
38
- },
39
-
40
- expect: function(actual) {
41
- return env.expect(actual);
42
- },
43
-
44
- spyOn: function(obj, methodName) {
45
- return env.spyOn(obj, methodName);
46
- },
47
-
48
- jsApiReporter: new jasmine.JsApiReporter({
49
- timer: new jasmine.Timer()
50
- })
51
- };
52
-
53
- extend(global, jasmineInterface);
54
-
55
- function extend(destination, source) {
56
- for (var property in source) destination[property] = source[property];
57
- return destination;
58
- }
59
-
60
- jasmine.addCustomEqualityTester = function(tester) {
61
- env.addCustomEqualityTester(tester);
62
- };
63
-
64
- jasmine.addMatchers = function(matchers) {
65
- return env.addMatchers(matchers);
66
- };
67
-
68
- jasmine.clock = function() {
69
- return env.clock;
70
- };
71
-
72
- // Jasmine "runner"
73
- function executeSpecs(specs, done, isVerbose, showColors) {
74
- global.jasmine = jasmine;
75
-
76
- for (var i = 0; i < specs.length; i++) {
77
- var filename = specs[i];
78
- require(filename.replace(/\.\w+$/, ""));
79
- }
80
-
81
- var env = jasmine.getEnv();
82
- var consoleReporter = new jasmine.ConsoleReporter({
83
- print: util.print,
84
- onComplete: done,
85
- showColors: showColors,
86
- timer: new jasmine.Timer()
87
- });
88
-
89
- env.addReporter(consoleReporter);
90
- env.execute();
91
- }
92
-
93
- function getFiles(dir, matcher) {
94
- var allFiles = [];
95
-
96
- if (fs.statSync(dir).isFile() && dir.match(matcher)) {
97
- allFiles.push(dir);
98
- } else {
99
- var files = fs.readdirSync(dir);
100
- for (var i = 0, len = files.length; i < len; ++i) {
101
- var filename = dir + '/' + files[i];
102
- if (fs.statSync(filename).isFile() && filename.match(matcher)) {
103
- allFiles.push(filename);
104
- } else if (fs.statSync(filename).isDirectory()) {
105
- var subfiles = getFiles(filename);
106
- subfiles.forEach(function(result) {
107
- allFiles.push(result);
108
- });
109
- }
110
- }
111
- }
112
- return allFiles;
113
- }
114
-
115
- function getSpecFiles(dir) {
116
- return getFiles(dir, new RegExp("Spec.js$"));
117
- }
118
-
119
- var j$require = (function() {
120
- var exported = {},
121
- j$req;
122
-
123
- global.getJasmineRequireObj = getJasmineRequireObj;
124
-
125
- j$req = require(__dirname + "/../src/core/requireCore.js");
126
- extend(j$req, require(__dirname + "/../src/console/requireConsole.js"));
127
-
128
- var srcFiles = getFiles(__dirname + "/../src/core");
129
- srcFiles.push(__dirname + "/../src/version.js");
130
- srcFiles.push(__dirname + "/../src/console/ConsoleReporter.js");
131
-
132
- for (var i = 0; i < srcFiles.length; i++) {
133
- require(srcFiles[i]);
134
- }
135
- extend(j$req, exported);
136
-
137
- delete global.getJasmineRequireObj;
138
-
139
- return j$req;
140
-
141
- function getJasmineRequireObj() {
142
- return exported;
143
- }
144
- }());
145
-
146
- j$ = j$require.core(j$require);
147
- j$require.console(j$require, j$);
148
-
149
- // options from command line
150
- var isVerbose = false;
151
- var showColors = true;
152
- var perfSuite = false;
153
-
154
- process.argv.forEach(function(arg) {
155
- switch (arg) {
156
- case '--color':
157
- showColors = true;
158
- break;
159
- case '--noColor':
160
- showColors = false;
161
- break;
162
- case '--verbose':
163
- isVerbose = true;
164
- break;
165
- case '--perf':
166
- perfSuite = true;
167
- break;
168
- }
169
- });
170
-
171
- specs = [];
172
-
173
- if (perfSuite) {
174
- specs = getFiles(__dirname + '/performance', new RegExp("test.js$"));
175
- } else {
176
- var consoleSpecs = getSpecFiles(__dirname + "/console"),
177
- coreSpecs = getSpecFiles(__dirname + "/core"),
178
- specs = consoleSpecs.concat(coreSpecs);
179
- }
180
-
181
- executeSpecs(specs, function(passed) {
182
- if (passed) {
183
- process.exit(0);
184
- } else {
185
- process.exit(1);
186
- }
187
- }, isVerbose, showColors);
@@ -1,124 +0,0 @@
1
- // Jasmine boot.js for browser runners - exposes external/global interface, builds the Jasmine environment and executes it.
2
- (function() {
3
-
4
- window.jasmine = jasmineRequire.core(jasmineRequire);
5
- jasmineRequire.html(jasmine);
6
-
7
- var env = jasmine.getEnv();
8
-
9
- var jasmineInterface = {
10
- describe: function(description, specDefinitions) {
11
- return env.describe(description, specDefinitions);
12
- },
13
-
14
- xdescribe: function(description, specDefinitions) {
15
- return env.xdescribe(description, specDefinitions);
16
- },
17
-
18
- it: function(desc, func) {
19
- return env.it(desc, func);
20
- },
21
-
22
- xit: function(desc, func) {
23
- return env.xit(desc, func);
24
- },
25
-
26
- beforeEach: function(beforeEachFunction) {
27
- return env.beforeEach(beforeEachFunction);
28
- },
29
-
30
- afterEach: function(afterEachFunction) {
31
- return env.afterEach(afterEachFunction);
32
- },
33
-
34
- expect: function(actual) {
35
- return env.expect(actual);
36
- },
37
-
38
- pending: function() {
39
- return env.pending();
40
- },
41
-
42
- spyOn: function(obj, methodName) {
43
- return env.spyOn(obj, methodName);
44
- },
45
-
46
- jsApiReporter: new jasmine.JsApiReporter({
47
- timer: new jasmine.Timer()
48
- })
49
- };
50
-
51
- if (typeof window == "undefined" && typeof exports == "object") {
52
- extend(exports, jasmineInterface);
53
- } else {
54
- extend(window, jasmineInterface);
55
- }
56
-
57
- jasmine.addCustomEqualityTester = function(tester) {
58
- env.addCustomEqualityTester(tester);
59
- };
60
-
61
- jasmine.addMatchers = function(matchers) {
62
- return env.addMatchers(matchers);
63
- };
64
-
65
- jasmine.clock = function() {
66
- return env.clock;
67
- };
68
-
69
- var queryString = new jasmine.QueryString({
70
- getWindowLocation: function() { return window.location; }
71
- });
72
-
73
- // TODO: move all of catching to raise so we don't break our brains
74
- var catchingExceptions = queryString.getParam("catch");
75
- env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
76
-
77
- var htmlReporter = new jasmine.HtmlReporter({
78
- env: env,
79
- onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
80
- getContainer: function() { return document.body; },
81
- createElement: function() { return document.createElement.apply(document, arguments); },
82
- createTextNode: function() { return document.createTextNode.apply(document, arguments); },
83
- timer: new jasmine.Timer()
84
- });
85
-
86
- env.addReporter(jasmineInterface.jsApiReporter);
87
- env.addReporter(htmlReporter);
88
-
89
- var specFilter = new jasmine.HtmlSpecFilter({
90
- filterString: function() { return queryString.getParam("spec"); }
91
- });
92
-
93
- env.specFilter = function(spec) {
94
- return specFilter.matches(spec.getFullName());
95
- };
96
-
97
- window.setTimeout = window.setTimeout;
98
- window.setInterval = window.setInterval;
99
- window.clearTimeout = window.clearTimeout;
100
- window.clearInterval = window.clearInterval;
101
-
102
- var currentWindowOnload = window.onload;
103
-
104
- window.onload = function() {
105
- if (currentWindowOnload) {
106
- currentWindowOnload();
107
- }
108
- htmlReporter.initialize();
109
-
110
- // By the time onload is called, jasmineRequire will be redefined to point
111
- // to the Jasmine source files (and not jasmine.js). So re-require
112
- window.j$ = jasmineRequire.core(jasmineRequire);
113
- jasmineRequire.html(j$);
114
- jasmineRequire.console(jasmineRequire, j$);
115
-
116
- env.execute();
117
- };
118
-
119
- function extend(destination, source) {
120
- for (var property in source) destination[property] = source[property];
121
- return destination;
122
- }
123
-
124
- }());