evergreen 1.0.0.rc → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.rdoc +10 -2
  2. data/config/routes.rb +1 -1
  3. data/lib/evergreen.rb +2 -6
  4. data/lib/evergreen/application.rb +38 -59
  5. data/lib/evergreen/cli.rb +2 -2
  6. data/lib/evergreen/runner.rb +6 -3
  7. data/lib/evergreen/server.rb +1 -5
  8. data/lib/evergreen/suite.rb +1 -13
  9. data/lib/evergreen/tasks.rb +1 -1
  10. data/lib/evergreen/version.rb +1 -1
  11. data/lib/jasmine/Contribute.markdown +44 -0
  12. data/lib/jasmine/Gemfile +4 -6
  13. data/lib/jasmine/MIT.LICENSE +1 -1
  14. data/lib/jasmine/README.markdown +17 -14
  15. data/lib/jasmine/Rakefile +21 -170
  16. data/lib/jasmine/Release.markdown +40 -0
  17. data/lib/jasmine/images/jasmine_favicon.png +0 -0
  18. data/lib/jasmine/jasmine-core.gemspec +22 -0
  19. data/lib/jasmine/jshint/jshint.js +5919 -0
  20. data/lib/jasmine/jshint/run.js +99 -0
  21. data/lib/jasmine/lib/jasmine-core.rb +36 -0
  22. data/lib/jasmine/lib/jasmine-core/example/SpecRunner.html +54 -0
  23. data/lib/jasmine/{example → lib/jasmine-core/example}/spec/PlayerSpec.js +0 -0
  24. data/lib/jasmine/{example → lib/jasmine-core/example}/spec/SpecHelper.js +3 -3
  25. data/lib/jasmine/{example → lib/jasmine-core/example}/src/Player.js +0 -0
  26. data/lib/jasmine/{example → lib/jasmine-core/example}/src/Song.js +0 -0
  27. data/lib/jasmine/lib/{jasmine-html.js → jasmine-core/jasmine-html.js} +6 -4
  28. data/lib/jasmine/lib/{jasmine.css → jasmine-core/jasmine.css} +0 -0
  29. data/lib/jasmine/lib/{jasmine.js → jasmine-core/jasmine.js} +103 -48
  30. data/lib/jasmine/lib/{json2.js → jasmine-core/json2.js} +0 -0
  31. data/lib/jasmine/lib/jasmine-core/version.rb +6 -0
  32. data/lib/jasmine/spec/console/ConsoleReporterSpec.js +451 -0
  33. data/lib/jasmine/spec/{suites → core}/BaseSpec.js +0 -0
  34. data/lib/jasmine/spec/{suites → core}/CustomMatchersSpec.js +0 -0
  35. data/lib/jasmine/spec/{suites → core}/EnvSpec.js +3 -2
  36. data/lib/jasmine/spec/{suites → core}/ExceptionsSpec.js +46 -4
  37. data/lib/jasmine/spec/{suites → core}/JsApiReporterSpec.js +1 -1
  38. data/lib/jasmine/spec/{suites → core}/MatchersSpec.js +87 -44
  39. data/lib/jasmine/spec/{suites → core}/MockClockSpec.js +0 -0
  40. data/lib/jasmine/spec/{suites → core}/MultiReporterSpec.js +3 -3
  41. data/lib/jasmine/spec/{suites → core}/NestedResultsSpec.js +0 -0
  42. data/lib/jasmine/spec/{suites → core}/PrettyPrintSpec.js +0 -6
  43. data/lib/jasmine/spec/{suites → core}/QueueSpec.js +0 -0
  44. data/lib/jasmine/spec/{suites → core}/ReporterSpec.js +0 -0
  45. data/lib/jasmine/spec/{suites → core}/RunnerSpec.js +0 -0
  46. data/lib/jasmine/spec/{suites → core}/SpecRunningSpec.js +14 -9
  47. data/lib/jasmine/spec/{suites → core}/SpecSpec.js +1 -1
  48. data/lib/jasmine/spec/{suites → core}/SpySpec.js +0 -0
  49. data/lib/jasmine/spec/{suites → core}/SuiteSpec.js +0 -0
  50. data/lib/jasmine/spec/{suites → core}/UtilSpec.js +0 -1
  51. data/lib/jasmine/spec/{suites → core}/WaitsForBlockSpec.js +32 -1
  52. data/lib/jasmine/spec/html/MatchersHtmlSpec.js +38 -0
  53. data/lib/jasmine/spec/html/PrettyPrintHtmlSpec.js +8 -0
  54. data/lib/jasmine/spec/{suites → html}/TrivialReporterSpec.js +3 -2
  55. data/lib/jasmine/spec/node_suite.js +127 -0
  56. data/lib/jasmine/spec/runner.html +44 -45
  57. data/lib/jasmine/spec/templates/runner.html.erb +49 -0
  58. data/lib/jasmine/spec/templates/script_tag.html.erb +1 -0
  59. data/lib/jasmine/src/SourcesList.json +7 -0
  60. data/lib/jasmine/src/console/ConsoleReporter.js +177 -0
  61. data/lib/jasmine/src/{Block.js → core/Block.js} +1 -1
  62. data/lib/jasmine/src/{Env.js → core/Env.js} +13 -8
  63. data/lib/jasmine/src/{JsApiReporter.js → core/JsApiReporter.js} +0 -0
  64. data/lib/jasmine/src/{Matchers.js → core/Matchers.js} +24 -7
  65. data/lib/jasmine/src/{MultiReporter.js → core/MultiReporter.js} +0 -0
  66. data/lib/jasmine/src/{NestedResults.js → core/NestedResults.js} +0 -0
  67. data/lib/jasmine/src/{PrettyPrinter.js → core/PrettyPrinter.js} +2 -1
  68. data/lib/jasmine/src/{Queue.js → core/Queue.js} +0 -0
  69. data/lib/jasmine/src/{Reporter.js → core/Reporter.js} +0 -0
  70. data/lib/jasmine/src/{Runner.js → core/Runner.js} +1 -1
  71. data/lib/jasmine/src/{Spec.js → core/Spec.js} +2 -1
  72. data/lib/jasmine/src/{Suite.js → core/Suite.js} +1 -1
  73. data/lib/jasmine/src/{WaitsBlock.js → core/WaitsBlock.js} +3 -1
  74. data/lib/jasmine/src/{WaitsForBlock.js → core/WaitsForBlock.js} +4 -2
  75. data/lib/jasmine/src/{base.js → core/base.js} +52 -24
  76. data/lib/jasmine/src/{mock-timeout.js → core/mock-timeout.js} +0 -0
  77. data/lib/jasmine/src/{util.js → core/util.js} +1 -1
  78. data/lib/jasmine/src/html/TrivialReporter.js +6 -4
  79. data/lib/jasmine/src/templates/example_project_jasmine_tags.html.erb +3 -0
  80. data/lib/jasmine/src/templates/version.js.erb +6 -0
  81. data/lib/jasmine/src/templates/version.rb.erb +6 -0
  82. data/lib/jasmine/src/version.js +6 -0
  83. data/lib/jasmine/src/version.json +2 -2
  84. data/lib/jasmine/tasks/build_dist.rb +48 -0
  85. data/lib/jasmine/tasks/build_specs.rb +50 -0
  86. data/lib/jasmine/tasks/docs.rb +17 -0
  87. data/lib/jasmine/tasks/helpers.rb +50 -0
  88. data/lib/jasmine/tasks/pages.rb +13 -0
  89. data/lib/jasmine/tasks/spec.rb +37 -0
  90. data/lib/jasmine/tasks/standalone.rb +91 -0
  91. data/lib/jasmine/tasks/version.rb +5 -0
  92. data/lib/tasks/evergreen.rake +1 -1
  93. data/spec/evergreen_spec.rb +6 -7
  94. data/spec/runner_spec.rb +1 -1
  95. data/spec/spec_helper.rb +5 -8
  96. metadata +95 -77
  97. data/lib/jasmine/cruise_config.rb +0 -21
  98. data/lib/jasmine/example/SpecRunner.html +0 -27
  99. data/lib/jasmine/images/fail-16.png +0 -0
  100. data/lib/jasmine/images/fail.png +0 -0
  101. data/lib/jasmine/images/go-16.png +0 -0
  102. data/lib/jasmine/images/go.png +0 -0
  103. data/lib/jasmine/images/pending-16.png +0 -0
  104. data/lib/jasmine/images/pending.png +0 -0
  105. data/lib/jasmine/images/question-bk.png +0 -0
  106. data/lib/jasmine/images/questionbk-16.png +0 -0
  107. data/lib/jasmine/images/spinner.gif +0 -0
@@ -19,4 +19,4 @@ jasmine.Block.prototype.execute = function(onComplete) {
19
19
  this.spec.fail(e);
20
20
  }
21
21
  onComplete();
22
- };
22
+ };
@@ -51,12 +51,17 @@ jasmine.Env.prototype.version = function () {
51
51
  * @returns string containing jasmine version build info, if set.
52
52
  */
53
53
  jasmine.Env.prototype.versionString = function() {
54
- if (jasmine.version_) {
55
- var version = this.version();
56
- return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
57
- } else {
54
+ if (!jasmine.version_) {
58
55
  return "version unknown";
59
56
  }
57
+
58
+ var version = this.version();
59
+ var versionString = version.major + "." + version.minor + "." + version.build;
60
+ if (version.release_candidate) {
61
+ versionString += ".rc" + version.release_candidate;
62
+ }
63
+ versionString += " revision " + version.revision;
64
+ return versionString;
60
65
  };
61
66
 
62
67
  /**
@@ -104,14 +109,14 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) {
104
109
  declarationError = e;
105
110
  }
106
111
 
107
- this.currentSuite = parentSuite;
108
-
109
112
  if (declarationError) {
110
113
  this.it("encountered a declaration exception", function() {
111
114
  throw declarationError;
112
115
  });
113
116
  }
114
117
 
118
+ this.currentSuite = parentSuite;
119
+
115
120
  return suite;
116
121
  };
117
122
 
@@ -172,7 +177,7 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
172
177
  b.__Jasmine_been_here_before__ = a;
173
178
 
174
179
  var hasKey = function(obj, keyName) {
175
- return obj != null && obj[keyName] !== jasmine.undefined;
180
+ return obj !== null && obj[keyName] !== jasmine.undefined;
176
181
  };
177
182
 
178
183
  for (var property in b) {
@@ -198,7 +203,7 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
198
203
 
199
204
  delete a.__Jasmine_been_here_before__;
200
205
  delete b.__Jasmine_been_here_before__;
201
- return (mismatchKeys.length == 0 && mismatchValues.length == 0);
206
+ return (mismatchKeys.length === 0 && mismatchValues.length === 0);
202
207
  };
203
208
 
204
209
  jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
@@ -227,16 +227,16 @@ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
227
227
  throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
228
228
  }
229
229
  this.message = function() {
230
- if (this.actual.callCount == 0) {
230
+ if (this.actual.callCount === 0) {
231
231
  // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
232
232
  return [
233
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
234
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
233
+ "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
234
+ "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
235
235
  ];
236
236
  } else {
237
237
  return [
238
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
239
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
238
+ "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
239
+ "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
240
240
  ];
241
241
  }
242
242
  };
@@ -258,7 +258,7 @@ jasmine.Matchers.prototype.wasNotCalledWith = function() {
258
258
  return [
259
259
  "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
260
260
  "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
261
- ]
261
+ ];
262
262
  };
263
263
 
264
264
  return !this.env.contains_(this.actual.argsForCall, expectedArgs);
@@ -291,6 +291,23 @@ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
291
291
  return this.actual > expected;
292
292
  };
293
293
 
294
+ /**
295
+ * Matcher that checks that the expected item is equal to the actual item
296
+ * up to a given level of decimal precision (default 2).
297
+ *
298
+ * @param {Number} expected
299
+ * @param {Number} precision
300
+ */
301
+ jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
302
+ if (!(precision === 0)) {
303
+ precision = precision || 2;
304
+ }
305
+ var multiplier = Math.pow(10, precision);
306
+ var actual = Math.round(this.actual * multiplier);
307
+ expected = Math.round(expected * multiplier);
308
+ return expected == actual;
309
+ };
310
+
294
311
  /**
295
312
  * Matcher that checks that the expected exception was thrown by the actual.
296
313
  *
@@ -315,7 +332,7 @@ jasmine.Matchers.prototype.toThrow = function(expected) {
315
332
 
316
333
  this.message = function() {
317
334
  if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
318
- return ["Expected function " + not + "to throw", expected ? expected.message || expected : " an exception", ", but it threw", exception.message || exception].join(' ');
335
+ return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
319
336
  } else {
320
337
  return "Expected function to throw an exception.";
321
338
  }
@@ -58,7 +58,8 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
58
58
  jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
59
59
  for (var property in obj) {
60
60
  if (property == '__Jasmine_been_here_before__') continue;
61
- fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
61
+ fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
62
+ obj.__lookupGetter__(property) !== null) : false);
62
63
  }
63
64
  };
64
65
 
@@ -74,4 +74,4 @@ jasmine.Runner.prototype.topLevelSuites = function() {
74
74
 
75
75
  jasmine.Runner.prototype.results = function() {
76
76
  return this.queue.results();
77
- };
77
+ };
@@ -120,7 +120,8 @@ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessag
120
120
  jasmine.Spec.prototype.fail = function (e) {
121
121
  var expectationResult = new jasmine.ExpectationResult({
122
122
  passed: false,
123
- message: e ? jasmine.util.formatException(e) : 'Exception'
123
+ message: e ? jasmine.util.formatException(e) : 'Exception',
124
+ trace: { stack: e.stack }
124
125
  });
125
126
  this.results_.addResult(expectationResult);
126
127
  };
@@ -79,4 +79,4 @@ jasmine.Suite.prototype.execute = function(onComplete) {
79
79
  this.queue.start(function () {
80
80
  self.finish(onComplete);
81
81
  });
82
- };
82
+ };
@@ -6,7 +6,9 @@ jasmine.WaitsBlock = function(env, timeout, spec) {
6
6
  jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
7
7
 
8
8
  jasmine.WaitsBlock.prototype.execute = function (onComplete) {
9
- this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
9
+ if (jasmine.VERBOSE) {
10
+ this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
11
+ }
10
12
  this.env.setTimeout(function () {
11
13
  onComplete();
12
14
  }, this.timeout);
@@ -21,7 +21,9 @@ jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
21
21
  jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10;
22
22
 
23
23
  jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
24
- this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
24
+ if (jasmine.VERBOSE) {
25
+ this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
26
+ }
25
27
  var latchFunctionResult;
26
28
  try {
27
29
  latchFunctionResult = this.latchFunction.apply(this.spec);
@@ -49,4 +51,4 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
49
51
  self.execute(onComplete);
50
52
  }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
51
53
  }
52
- };
54
+ };
@@ -1,10 +1,12 @@
1
+ var isCommonJS = typeof window == "undefined";
2
+
1
3
  /**
2
4
  * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
3
5
  *
4
6
  * @namespace
5
7
  */
6
8
  var jasmine = {};
7
-
9
+ if (isCommonJS) exports.jasmine = jasmine;
8
10
  /**
9
11
  * @private
10
12
  */
@@ -20,6 +22,12 @@ jasmine.unimplementedMethod_ = function() {
20
22
  */
21
23
  jasmine.undefined = jasmine.___undefined___;
22
24
 
25
+ /**
26
+ * Show diagnostic messages in the console if set to true
27
+ *
28
+ */
29
+ jasmine.VERBOSE = false;
30
+
23
31
  /**
24
32
  * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
25
33
  *
@@ -72,7 +80,7 @@ jasmine.MessageResult = function(values) {
72
80
 
73
81
  jasmine.MessageResult.prototype.toString = function() {
74
82
  var text = "";
75
- for(var i = 0; i < this.values.length; i++) {
83
+ for (var i = 0; i < this.values.length; i++) {
76
84
  if (i > 0) text += " ";
77
85
  if (jasmine.isString_(this.values[i])) {
78
86
  text += this.values[i];
@@ -89,9 +97,10 @@ jasmine.ExpectationResult = function(params) {
89
97
  this.passed_ = params.passed;
90
98
  this.expected = params.expected;
91
99
  this.actual = params.actual;
92
-
93
100
  this.message = this.passed_ ? 'Passed.' : params.message;
94
- this.trace = this.passed_ ? '' : new Error(this.message);
101
+
102
+ var trace = (params.trace || new Error(this.message));
103
+ this.trace = this.passed_ ? '' : trace;
95
104
  };
96
105
 
97
106
  jasmine.ExpectationResult.prototype.toString = function () {
@@ -106,7 +115,8 @@ jasmine.ExpectationResult.prototype.passed = function () {
106
115
  * Getter for the Jasmine environment. Ensures one gets created
107
116
  */
108
117
  jasmine.getEnv = function() {
109
- return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
118
+ var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
119
+ return env;
110
120
  };
111
121
 
112
122
  /**
@@ -116,7 +126,7 @@ jasmine.getEnv = function() {
116
126
  * @returns {Boolean}
117
127
  */
118
128
  jasmine.isArray_ = function(value) {
119
- return jasmine.isA_("Array", value);
129
+ return jasmine.isA_("Array", value);
120
130
  };
121
131
 
122
132
  /**
@@ -169,7 +179,7 @@ jasmine.pp = function(value) {
169
179
  * @returns {Boolean}
170
180
  */
171
181
  jasmine.isDomNode = function(obj) {
172
- return obj['nodeType'] > 0;
182
+ return obj.nodeType > 0;
173
183
  };
174
184
 
175
185
  /**
@@ -405,7 +415,7 @@ jasmine.isSpy = function(putativeSpy) {
405
415
  * @param {Array} methodNames array of names of methods to make spies
406
416
  */
407
417
  jasmine.createSpyObj = function(baseName, methodNames) {
408
- if (!jasmine.isArray_(methodNames) || methodNames.length == 0) {
418
+ if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
409
419
  throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
410
420
  }
411
421
  var obj = {};
@@ -443,6 +453,7 @@ jasmine.log = function() {
443
453
  var spyOn = function(obj, methodName) {
444
454
  return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
445
455
  };
456
+ if (isCommonJS) exports.spyOn = spyOn;
446
457
 
447
458
  /**
448
459
  * Creates a Jasmine spec that will be added to the current suite.
@@ -460,6 +471,7 @@ var spyOn = function(obj, methodName) {
460
471
  var it = function(desc, func) {
461
472
  return jasmine.getEnv().it(desc, func);
462
473
  };
474
+ if (isCommonJS) exports.it = it;
463
475
 
464
476
  /**
465
477
  * Creates a <em>disabled</em> Jasmine spec.
@@ -472,6 +484,7 @@ var it = function(desc, func) {
472
484
  var xit = function(desc, func) {
473
485
  return jasmine.getEnv().xit(desc, func);
474
486
  };
487
+ if (isCommonJS) exports.xit = xit;
475
488
 
476
489
  /**
477
490
  * Starts a chain for a Jasmine expectation.
@@ -484,6 +497,7 @@ var xit = function(desc, func) {
484
497
  var expect = function(actual) {
485
498
  return jasmine.getEnv().currentSpec.expect(actual);
486
499
  };
500
+ if (isCommonJS) exports.expect = expect;
487
501
 
488
502
  /**
489
503
  * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
@@ -493,6 +507,7 @@ var expect = function(actual) {
493
507
  var runs = function(func) {
494
508
  jasmine.getEnv().currentSpec.runs(func);
495
509
  };
510
+ if (isCommonJS) exports.runs = runs;
496
511
 
497
512
  /**
498
513
  * Waits a fixed time period before moving to the next block.
@@ -503,6 +518,7 @@ var runs = function(func) {
503
518
  var waits = function(timeout) {
504
519
  jasmine.getEnv().currentSpec.waits(timeout);
505
520
  };
521
+ if (isCommonJS) exports.waits = waits;
506
522
 
507
523
  /**
508
524
  * Waits for the latchFunction to return true before proceeding to the next block.
@@ -514,6 +530,7 @@ var waits = function(timeout) {
514
530
  var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
515
531
  jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
516
532
  };
533
+ if (isCommonJS) exports.waitsFor = waitsFor;
517
534
 
518
535
  /**
519
536
  * A function that is called before each spec in a suite.
@@ -525,6 +542,7 @@ var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout
525
542
  var beforeEach = function(beforeEachFunction) {
526
543
  jasmine.getEnv().beforeEach(beforeEachFunction);
527
544
  };
545
+ if (isCommonJS) exports.beforeEach = beforeEach;
528
546
 
529
547
  /**
530
548
  * A function that is called after each spec in a suite.
@@ -536,6 +554,7 @@ var beforeEach = function(beforeEachFunction) {
536
554
  var afterEach = function(afterEachFunction) {
537
555
  jasmine.getEnv().afterEach(afterEachFunction);
538
556
  };
557
+ if (isCommonJS) exports.afterEach = afterEach;
539
558
 
540
559
  /**
541
560
  * Defines a suite of specifications.
@@ -555,6 +574,7 @@ var afterEach = function(afterEachFunction) {
555
574
  var describe = function(description, specDefinitions) {
556
575
  return jasmine.getEnv().describe(description, specDefinitions);
557
576
  };
577
+ if (isCommonJS) exports.describe = describe;
558
578
 
559
579
  /**
560
580
  * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
@@ -565,25 +585,33 @@ var describe = function(description, specDefinitions) {
565
585
  var xdescribe = function(description, specDefinitions) {
566
586
  return jasmine.getEnv().xdescribe(description, specDefinitions);
567
587
  };
588
+ if (isCommonJS) exports.xdescribe = xdescribe;
568
589
 
569
590
 
570
591
  // Provide the XMLHttpRequest class for IE 5.x-6.x:
571
592
  jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
572
- try {
573
- return new ActiveXObject("Msxml2.XMLHTTP.6.0");
574
- } catch(e) {
575
- }
576
- try {
577
- return new ActiveXObject("Msxml2.XMLHTTP.3.0");
578
- } catch(e) {
579
- }
580
- try {
581
- return new ActiveXObject("Msxml2.XMLHTTP");
582
- } catch(e) {
583
- }
584
- try {
585
- return new ActiveXObject("Microsoft.XMLHTTP");
586
- } catch(e) {
593
+ function tryIt(f) {
594
+ try {
595
+ return f();
596
+ } catch(e) {
597
+ }
598
+ return null;
587
599
  }
588
- throw new Error("This browser does not support XMLHttpRequest.");
600
+
601
+ var xhr = tryIt(function() {
602
+ return new ActiveXObject("Msxml2.XMLHTTP.6.0");
603
+ }) ||
604
+ tryIt(function() {
605
+ return new ActiveXObject("Msxml2.XMLHTTP.3.0");
606
+ }) ||
607
+ tryIt(function() {
608
+ return new ActiveXObject("Msxml2.XMLHTTP");
609
+ }) ||
610
+ tryIt(function() {
611
+ return new ActiveXObject("Microsoft.XMLHTTP");
612
+ });
613
+
614
+ if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
615
+
616
+ return xhr;
589
617
  } : XMLHttpRequest;
@@ -17,7 +17,7 @@ jasmine.util.inherit = function(childClass, parentClass) {
17
17
  var subclass = function() {
18
18
  };
19
19
  subclass.prototype = parentClass.prototype;
20
- childClass.prototype = new subclass;
20
+ childClass.prototype = new subclass();
21
21
  };
22
22
 
23
23
  jasmine.util.formatException = function(e) {
@@ -34,7 +34,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
34
34
  this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
35
35
  this.createDom('div', { className: 'banner' },
36
36
  this.createDom('div', { className: 'logo' },
37
- this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
37
+ this.createDom('span', { className: 'title' }, "Jasmine"),
38
38
  this.createDom('span', { className: 'version' }, runner.env.versionString())),
39
39
  this.createDom('div', { className: 'options' },
40
40
  "Show ",
@@ -110,7 +110,7 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
110
110
  jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
111
111
  var results = suite.results();
112
112
  var status = results.passed() ? 'passed' : 'failed';
113
- if (results.totalCount == 0) { // todo: change this to check results.skipped
113
+ if (results.totalCount === 0) { // todo: change this to check results.skipped
114
114
  status = 'skipped';
115
115
  }
116
116
  this.suiteDivs[suite.id].className += " " + status;
@@ -183,6 +183,8 @@ jasmine.TrivialReporter.prototype.specFilter = function(spec) {
183
183
  paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
184
184
  }
185
185
 
186
- if (!paramMap["spec"]) return true;
187
- return spec.getFullName().indexOf(paramMap["spec"]) == 0;
186
+ if (!paramMap.spec) {
187
+ return true;
188
+ }
189
+ return spec.getFullName().indexOf(paramMap.spec) === 0;
188
190
  };