jasmine-core 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 98e75bc149c63002aece96ae344bb358e807d187
4
- data.tar.gz: 454fb581fdf962b099c7ca2f827aee46f20e633f
2
+ SHA256:
3
+ metadata.gz: 4abe7ecadc16e210e425bdab1d2659b0fc5e9a5ce5e5a7ed1fb9493c84332948
4
+ data.tar.gz: 4663a9924802a7a4f8ffe750012bdda0bc0b8e253ba2af1eafa3a0ce69680f84
5
5
  SHA512:
6
- metadata.gz: 8afeb955927ee74c2371ade5308627d21beb8952061a619f9190e8feef3b92a15613dbd5cc2348a4df19019ac07bdfefb2e170db66035d074854d7965f870ee9
7
- data.tar.gz: 6d8e478948454fe8c03c990218450f46d0535fb5e7c4daa2e3668e0c6fe0fa15a1e488deed163e68f3ea496913d18dd16060d4018bb8bd0d6a3ace672588b04e
6
+ metadata.gz: 31abc1ef11771de90ec6c40c9f8bc3f98bf4a695d988d364a2c3eedd8ea237bd45852d674c2669f8b1ee7b77bf1b51b24136dfbd49a65e4cd99b2a3098dd0cd1
7
+ data.tar.gz: 4f7000528771e4a35225606af3cce05a9a3c318234a5a60d492a83496a25e52f267aa2cc81849d561a355d2cc21decbd05e7b44efe0e173e96c0418e838a8092
@@ -78,6 +78,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
78
78
 
79
79
  var throwingExpectationFailures = queryString.getParam("throwFailures");
80
80
  env.throwOnExpectationFailure(throwingExpectationFailures);
81
+
82
+ var hideDisabled = queryString.getParam("hideDisabled");
83
+ env.hideDisabled(hideDisabled);
81
84
 
82
85
  var random = queryString.getParam("random");
83
86
 
@@ -56,6 +56,9 @@
56
56
 
57
57
  var throwingExpectationFailures = queryString.getParam("throwFailures");
58
58
  env.throwOnExpectationFailure(throwingExpectationFailures);
59
+
60
+ var hideDisabled = queryString.getParam("hideDisabled");
61
+ env.hideDisabled(hideDisabled);
59
62
 
60
63
  var random = queryString.getParam("random");
61
64
 
@@ -148,7 +148,7 @@ jasmineRequire.HtmlReporter = function(j$) {
148
148
  }
149
149
 
150
150
  symbols.appendChild(createDom('li', {
151
- className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
151
+ className: this.displaySpecInCorrectFormat(result),
152
152
  id: 'spec_' + result.id,
153
153
  title: result.fullName
154
154
  }
@@ -161,10 +161,22 @@ jasmineRequire.HtmlReporter = function(j$) {
161
161
  addDeprecationWarnings(result);
162
162
  };
163
163
 
164
+ this.displaySpecInCorrectFormat = function(result) {
165
+ return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
166
+ };
167
+
168
+ this.resultStatus = function(status) {
169
+ if(status === 'excluded') {
170
+ return env.hidingDisabled() ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
171
+ }
172
+ return 'jasmine-' + status;
173
+ };
174
+
164
175
  this.jasmineDone = function(doneResult) {
165
176
  var banner = find('.jasmine-banner');
166
177
  var alert = find('.jasmine-alert');
167
178
  var order = doneResult && doneResult.order;
179
+ var i;
168
180
  alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
169
181
 
170
182
  banner.appendChild(optionsMenu(env));
@@ -351,7 +363,14 @@ jasmineRequire.HtmlReporter = function(j$) {
351
363
  id: 'jasmine-random-order',
352
364
  type: 'checkbox'
353
365
  }),
354
- createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
366
+ createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
367
+ createDom('div', { className: 'jasmine-hide-disabled' },
368
+ createDom('input', {
369
+ className: 'jasmine-disabled',
370
+ id: 'jasmine-hide-disabled',
371
+ type: 'checkbox'
372
+ }),
373
+ createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
355
374
  )
356
375
  );
357
376
 
@@ -373,6 +392,12 @@ jasmineRequire.HtmlReporter = function(j$) {
373
392
  navigateWithNewParam('random', !env.randomTests());
374
393
  };
375
394
 
395
+ var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled');
396
+ hideDisabled.checked = env.hidingDisabled();
397
+ hideDisabled.onclick = function() {
398
+ navigateWithNewParam('hideDisabled', !env.hidingDisabled());
399
+ };
400
+
376
401
  var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
377
402
  optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
378
403
  isOpen = /\bjasmine-open\b/;
@@ -20,6 +20,7 @@ body { overflow-y: scroll; }
20
20
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed:before { color: #ca3a11; content: "\d7"; font-weight: bold; margin-left: -1px; }
21
21
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded { font-size: 14px; }
22
22
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded:before { color: #bababa; content: "\02022"; }
23
+ .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded-no-display { font-size: 14px; display: none; }
23
24
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending { line-height: 17px; }
24
25
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending:before { color: #ba9d37; content: "*"; }
25
26
  .jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty { font-size: 14px; }
@@ -54,6 +55,6 @@ body { overflow-y: scroll; }
54
55
  .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail { margin-bottom: 28px; }
55
56
  .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description { background-color: #ca3a11; color: white; }
56
57
  .jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description a { color: white; }
57
- .jasmine_html-reporter .jasmine-result-message { padding-top: 14px; color: #333; white-space: pre; }
58
+ .jasmine_html-reporter .jasmine-result-message { padding-top: 14px; color: #333; white-space: pre-wrap; }
58
59
  .jasmine_html-reporter .jasmine-result-message span.jasmine-result { display: block; }
59
60
  .jasmine_html-reporter .jasmine-stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666; border: 1px solid #ddd; background: white; white-space: pre; }
@@ -21,6 +21,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
  var getJasmineRequireObj = (function (jasmineGlobal) {
24
+ /* globals exports, global, module, window */
24
25
  var jasmineRequire;
25
26
 
26
27
  if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
@@ -59,6 +60,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
59
60
  j$.StackTrace = jRequire.StackTrace(j$);
60
61
  j$.ExceptionFormatter = jRequire.ExceptionFormatter(j$);
61
62
  j$.Expectation = jRequire.Expectation();
63
+ j$.AsyncExpectation = jRequire.AsyncExpectation(j$);
62
64
  j$.buildExpectationResult = jRequire.buildExpectationResult();
63
65
  j$.JsApiReporter = jRequire.JsApiReporter();
64
66
  j$.matchersUtil = jRequire.matchersUtil(j$);
@@ -240,7 +242,14 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
240
242
  };
241
243
 
242
244
  j$.isDomNode = function(obj) {
243
- return obj.nodeType > 0;
245
+ // Node is a function, because constructors
246
+ return typeof jasmineGlobal.Node !== 'undefined' ?
247
+ obj instanceof jasmineGlobal.Node :
248
+ obj !== null &&
249
+ typeof obj === 'object' &&
250
+ typeof obj.nodeType === 'number' &&
251
+ typeof obj.nodeName === 'string';
252
+ // return obj.nodeType > 0;
244
253
  };
245
254
 
246
255
  j$.isMap = function(obj) {
@@ -252,7 +261,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
252
261
  };
253
262
 
254
263
  j$.isPromise = function(obj) {
255
- return typeof jasmineGlobal.Promise !== 'undefined' && obj.constructor === jasmineGlobal.Promise;
264
+ return typeof jasmineGlobal.Promise !== 'undefined' && obj && obj.constructor === jasmineGlobal.Promise;
256
265
  };
257
266
 
258
267
  j$.fnNameFor = function(func) {
@@ -486,7 +495,7 @@ getJasmineRequireObj().util = function(j$) {
486
495
  return false;
487
496
  }
488
497
 
489
- function errorWithStack() {
498
+ util.errorWithStack = function errorWithStack () {
490
499
  // Don't throw and catch if we don't have to, because it makes it harder
491
500
  // for users to debug their code with exception breakpoints.
492
501
  var error = new Error();
@@ -501,10 +510,10 @@ getJasmineRequireObj().util = function(j$) {
501
510
  } catch (e) {
502
511
  return e;
503
512
  }
504
- }
513
+ };
505
514
 
506
515
  function callerFile() {
507
- var trace = new j$.StackTrace(errorWithStack().stack);
516
+ var trace = new j$.StackTrace(util.errorWithStack());
508
517
  return trace.frames[2].file;
509
518
  }
510
519
 
@@ -528,6 +537,7 @@ getJasmineRequireObj().util = function(j$) {
528
537
  getJasmineRequireObj().Spec = function(j$) {
529
538
  function Spec(attrs) {
530
539
  this.expectationFactory = attrs.expectationFactory;
540
+ this.asyncExpectationFactory = attrs.asyncExpectationFactory;
531
541
  this.resultCallback = attrs.resultCallback || function() {};
532
542
  this.id = attrs.id;
533
543
  this.description = attrs.description || '';
@@ -584,6 +594,10 @@ getJasmineRequireObj().Spec = function(j$) {
584
594
  return this.expectationFactory(actual, this);
585
595
  };
586
596
 
597
+ Spec.prototype.expectAsync = function(actual) {
598
+ return this.asyncExpectationFactory(actual, this);
599
+ };
600
+
587
601
  Spec.prototype.execute = function(onComplete, excluded) {
588
602
  var self = this;
589
603
 
@@ -704,6 +718,7 @@ getJasmineRequireObj().Spec = function(j$) {
704
718
  };
705
719
 
706
720
  if (typeof window == void 0 && typeof exports == 'object') {
721
+ /* globals exports */
707
722
  exports.Spec = jasmineRequire.Spec;
708
723
  }
709
724
 
@@ -769,9 +784,9 @@ getJasmineRequireObj().Env = function(j$) {
769
784
 
770
785
  var totalSpecsDefined = 0;
771
786
 
772
- var realSetTimeout = j$.getGlobal().setTimeout;
773
- var realClearTimeout = j$.getGlobal().clearTimeout;
774
- var clearStack = j$.getClearStack(j$.getGlobal());
787
+ var realSetTimeout = global.setTimeout;
788
+ var realClearTimeout = global.clearTimeout;
789
+ var clearStack = j$.getClearStack(global);
775
790
  this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
776
791
 
777
792
  var runnableResources = {};
@@ -782,6 +797,7 @@ getJasmineRequireObj().Env = function(j$) {
782
797
  var throwOnExpectationFailure = false;
783
798
  var stopOnSpecFailure = false;
784
799
  var random = true;
800
+ var hidingDisabled = false;
785
801
  var seed = null;
786
802
  var handlingLoadErrors = true;
787
803
  var hasFailures = false;
@@ -795,7 +811,7 @@ getJasmineRequireObj().Env = function(j$) {
795
811
  };
796
812
 
797
813
  var globalErrors = null;
798
-
814
+
799
815
  var installGlobalErrors = function() {
800
816
  if (globalErrors) {
801
817
  return;
@@ -872,6 +888,19 @@ getJasmineRequireObj().Env = function(j$) {
872
888
  }
873
889
  };
874
890
 
891
+ var asyncExpectationFactory = function(actual, spec) {
892
+ return j$.AsyncExpectation.factory({
893
+ util: j$.matchersUtil,
894
+ customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
895
+ actual: actual,
896
+ addExpectationResult: addExpectationResult
897
+ });
898
+
899
+ function addExpectationResult(passed, result) {
900
+ return spec.addExpectationResult(passed, result);
901
+ }
902
+ };
903
+
875
904
  var defaultResourcesForRunnable = function(id, parentRunnableId) {
876
905
  var resources = {spies: [], customEqualityTesters: [], customMatchers: {}, customSpyStrategies: {}};
877
906
 
@@ -930,6 +959,13 @@ getJasmineRequireObj().Env = function(j$) {
930
959
  var maximumSpecCallbackDepth = 20;
931
960
  var currentSpecCallbackDepth = 0;
932
961
 
962
+ /**
963
+ * Sets whether Jasmine should throw an Error when an expectation fails.
964
+ * This causes a spec to only have one expectation failure.
965
+ * @name Env#throwOnExpectationFailure
966
+ * @function
967
+ * @param {Boolean} value Whether to throw when a expectation fails
968
+ */
933
969
  this.throwOnExpectationFailure = function(value) {
934
970
  throwOnExpectationFailure = !!value;
935
971
  };
@@ -938,6 +974,12 @@ getJasmineRequireObj().Env = function(j$) {
938
974
  return throwOnExpectationFailure;
939
975
  };
940
976
 
977
+ /**
978
+ * Set whether to stop suite execution when a spec fails
979
+ * @name Env#stopOnSpecFailure
980
+ * @function
981
+ * @param {Boolean} value Whether to stop suite execution when a spec fails
982
+ */
941
983
  this.stopOnSpecFailure = function(value) {
942
984
  stopOnSpecFailure = !!value;
943
985
  };
@@ -946,6 +988,12 @@ getJasmineRequireObj().Env = function(j$) {
946
988
  return stopOnSpecFailure;
947
989
  };
948
990
 
991
+ /**
992
+ * Set whether to randomize test execution order
993
+ * @name Env#randomizeTests
994
+ * @function
995
+ * @param {Boolean} value Whether to randomize execution order
996
+ */
949
997
  this.randomizeTests = function(value) {
950
998
  random = !!value;
951
999
  };
@@ -954,6 +1002,12 @@ getJasmineRequireObj().Env = function(j$) {
954
1002
  return random;
955
1003
  };
956
1004
 
1005
+ /**
1006
+ * Set the random number seed for spec randomization
1007
+ * @name Env#seed
1008
+ * @function
1009
+ * @param {Number} value The seed value
1010
+ */
957
1011
  this.seed = function(value) {
958
1012
  if (value) {
959
1013
  seed = value;
@@ -961,6 +1015,18 @@ getJasmineRequireObj().Env = function(j$) {
961
1015
  return seed;
962
1016
  };
963
1017
 
1018
+ this.hidingDisabled = function(value) {
1019
+ return hidingDisabled;
1020
+ };
1021
+
1022
+ /**
1023
+ * @name Env#hideDisabled
1024
+ * @function
1025
+ */
1026
+ this.hideDisabled = function(value) {
1027
+ hidingDisabled = !!value;
1028
+ };
1029
+
964
1030
  this.deprecated = function(deprecation) {
965
1031
  var runnable = currentRunnable() || topSuite;
966
1032
  runnable.addDeprecationWarning(deprecation);
@@ -994,6 +1060,7 @@ getJasmineRequireObj().Env = function(j$) {
994
1060
  id: getNextSuiteId(),
995
1061
  description: 'Jasmine__TopLevel__Suite',
996
1062
  expectationFactory: expectationFactory,
1063
+ asyncExpectationFactory: asyncExpectationFactory,
997
1064
  expectationResultFactory: expectationResultFactory
998
1065
  });
999
1066
  defaultResourcesForRunnable(topSuite.id);
@@ -1006,6 +1073,7 @@ getJasmineRequireObj().Env = function(j$) {
1006
1073
  /**
1007
1074
  * This represents the available reporter callback for an object passed to {@link Env#addReporter}.
1008
1075
  * @interface Reporter
1076
+ * @see custom_reporter
1009
1077
  */
1010
1078
  var reporter = new j$.ReportDispatcher([
1011
1079
  /**
@@ -1015,6 +1083,7 @@ getJasmineRequireObj().Env = function(j$) {
1015
1083
  * @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run
1016
1084
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1017
1085
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1086
+ * @see async
1018
1087
  */
1019
1088
  'jasmineStarted',
1020
1089
  /**
@@ -1024,6 +1093,7 @@ getJasmineRequireObj().Env = function(j$) {
1024
1093
  * @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running.
1025
1094
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1026
1095
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1096
+ * @see async
1027
1097
  */
1028
1098
  'jasmineDone',
1029
1099
  /**
@@ -1033,6 +1103,7 @@ getJasmineRequireObj().Env = function(j$) {
1033
1103
  * @param {SuiteResult} result Information about the individual {@link describe} being run
1034
1104
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1035
1105
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1106
+ * @see async
1036
1107
  */
1037
1108
  'suiteStarted',
1038
1109
  /**
@@ -1044,6 +1115,7 @@ getJasmineRequireObj().Env = function(j$) {
1044
1115
  * @param {SuiteResult} result
1045
1116
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1046
1117
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1118
+ * @see async
1047
1119
  */
1048
1120
  'suiteDone',
1049
1121
  /**
@@ -1053,6 +1125,7 @@ getJasmineRequireObj().Env = function(j$) {
1053
1125
  * @param {SpecResult} result Information about the individual {@link it} being run
1054
1126
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1055
1127
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1128
+ * @see async
1056
1129
  */
1057
1130
  'specStarted',
1058
1131
  /**
@@ -1064,6 +1137,7 @@ getJasmineRequireObj().Env = function(j$) {
1064
1137
  * @param {SpecResult} result
1065
1138
  * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
1066
1139
  * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1140
+ * @see async
1067
1141
  */
1068
1142
  'specDone'
1069
1143
  ], queueRunnerFactory);
@@ -1152,8 +1226,8 @@ getJasmineRequireObj().Env = function(j$) {
1152
1226
  /**
1153
1227
  * Information passed to the {@link Reporter#jasmineDone} event.
1154
1228
  * @typedef JasmineDoneInfo
1155
- * @property {OverallStatus} - The overall result of the sute: 'passed', 'failed', or 'incomplete'.
1156
- * @property {IncompleteReason} - Explanation of why the suite was incimplete.
1229
+ * @property {OverallStatus} overallStatus - The overall result of the sute: 'passed', 'failed', or 'incomplete'.
1230
+ * @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
1157
1231
  * @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
1158
1232
  * @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
1159
1233
  * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
@@ -1180,10 +1254,22 @@ getJasmineRequireObj().Env = function(j$) {
1180
1254
  reporter.addReporter(reporterToAdd);
1181
1255
  };
1182
1256
 
1257
+ /**
1258
+ * Provide a fallback reporter if no other reporters have been specified.
1259
+ * @name Env#provideFallbackReporter
1260
+ * @function
1261
+ * @param {Reporter} reporterToAdd The reporter
1262
+ * @see custom_reporter
1263
+ */
1183
1264
  this.provideFallbackReporter = function(reporterToAdd) {
1184
1265
  reporter.provideFallbackReporter(reporterToAdd);
1185
1266
  };
1186
1267
 
1268
+ /**
1269
+ * Clear all registered reporters
1270
+ * @name Env#clearReporters
1271
+ * @function
1272
+ */
1187
1273
  this.clearReporters = function() {
1188
1274
  reporter.clearReporters();
1189
1275
  };
@@ -1223,6 +1309,11 @@ getJasmineRequireObj().Env = function(j$) {
1223
1309
  };
1224
1310
 
1225
1311
  this.createSpy = function(name, originalFn) {
1312
+ if (arguments.length === 1 && j$.isFunction_(name)) {
1313
+ originalFn = name;
1314
+ name = originalFn.name;
1315
+ }
1316
+
1226
1317
  return spyFactory.createSpy(name, originalFn);
1227
1318
  };
1228
1319
 
@@ -1256,6 +1347,7 @@ getJasmineRequireObj().Env = function(j$) {
1256
1347
  description: description,
1257
1348
  parentSuite: currentDeclarationSuite,
1258
1349
  expectationFactory: expectationFactory,
1350
+ asyncExpectationFactory: asyncExpectationFactory,
1259
1351
  expectationResultFactory: expectationResultFactory,
1260
1352
  throwOnExpectationFailure: throwOnExpectationFailure
1261
1353
  });
@@ -1349,6 +1441,7 @@ getJasmineRequireObj().Env = function(j$) {
1349
1441
  id: getNextSpecId(),
1350
1442
  beforeAndAfterFns: beforeAndAfterFns(suite),
1351
1443
  expectationFactory: expectationFactory,
1444
+ asyncExpectationFactory: asyncExpectationFactory,
1352
1445
  resultCallback: specResultCallback,
1353
1446
  getSpecName: function(spec) {
1354
1447
  return getSpecName(spec, suite);
@@ -1360,7 +1453,7 @@ getJasmineRequireObj().Env = function(j$) {
1360
1453
  userContext: function() { return suite.clonedSharedUserContext(); },
1361
1454
  queueableFn: {
1362
1455
  fn: fn,
1363
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
1456
+ timeout: timeout || 0
1364
1457
  },
1365
1458
  throwOnExpectationFailure: throwOnExpectationFailure
1366
1459
  });
@@ -1430,12 +1523,20 @@ getJasmineRequireObj().Env = function(j$) {
1430
1523
  return currentRunnable().expect(actual);
1431
1524
  };
1432
1525
 
1526
+ this.expectAsync = function(actual) {
1527
+ if (!currentRunnable()) {
1528
+ throw new Error('\'expectAsync\' was used when there was no current spec, this could be because an asynchronous test timed out');
1529
+ }
1530
+
1531
+ return currentRunnable().expectAsync(actual);
1532
+ };
1533
+
1433
1534
  this.beforeEach = function(beforeEachFunction, timeout) {
1434
1535
  ensureIsNotNested('beforeEach');
1435
1536
  ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
1436
1537
  currentDeclarationSuite.beforeEach({
1437
1538
  fn: beforeEachFunction,
1438
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
1539
+ timeout: timeout || 0
1439
1540
  });
1440
1541
  };
1441
1542
 
@@ -1444,7 +1545,7 @@ getJasmineRequireObj().Env = function(j$) {
1444
1545
  ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
1445
1546
  currentDeclarationSuite.beforeAll({
1446
1547
  fn: beforeAllFunction,
1447
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
1548
+ timeout: timeout || 0
1448
1549
  });
1449
1550
  };
1450
1551
 
@@ -1454,7 +1555,7 @@ getJasmineRequireObj().Env = function(j$) {
1454
1555
  afterEachFunction.isCleanup = true;
1455
1556
  currentDeclarationSuite.afterEach({
1456
1557
  fn: afterEachFunction,
1457
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
1558
+ timeout: timeout || 0
1458
1559
  });
1459
1560
  };
1460
1561
 
@@ -1463,7 +1564,7 @@ getJasmineRequireObj().Env = function(j$) {
1463
1564
  ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
1464
1565
  currentDeclarationSuite.afterAll({
1465
1566
  fn: afterAllFunction,
1466
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
1567
+ timeout: timeout || 0
1467
1568
  });
1468
1569
  };
1469
1570
 
@@ -1485,11 +1586,11 @@ getJasmineRequireObj().Env = function(j$) {
1485
1586
  message += ': ';
1486
1587
  if (error.message) {
1487
1588
  message += error.message;
1488
- } else if (jasmine.isString_(error)) {
1589
+ } else if (j$.isString_(error)) {
1489
1590
  message += error;
1490
1591
  } else {
1491
1592
  // pretty print all kind of objects. This includes arrays.
1492
- message += jasmine.pp(error);
1593
+ message += j$.pp(error);
1493
1594
  }
1494
1595
  }
1495
1596
 
@@ -1676,6 +1777,7 @@ getJasmineRequireObj().Any = function(j$) {
1676
1777
  }
1677
1778
 
1678
1779
  /* jshint -W122 */
1780
+ /* global Symbol */
1679
1781
  if (typeof Symbol != 'undefined' && this.expectedObject == Symbol) {
1680
1782
  return typeof other == 'symbol';
1681
1783
  }
@@ -1727,7 +1829,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
1727
1829
  };
1728
1830
 
1729
1831
  ArrayContaining.prototype.jasmineToString = function () {
1730
- return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
1832
+ return '<jasmine.arrayContaining(' + j$.pp(this.sample) +')>';
1731
1833
  };
1732
1834
 
1733
1835
  return ArrayContaining;
@@ -1919,6 +2021,160 @@ getJasmineRequireObj().Truthy = function(j$) {
1919
2021
  return Truthy;
1920
2022
  };
1921
2023
 
2024
+ getJasmineRequireObj().AsyncExpectation = function(j$) {
2025
+ var promiseForMessage = {
2026
+ jasmineToString: function() { return 'a promise'; }
2027
+ };
2028
+
2029
+ /**
2030
+ * Asynchronous matchers.
2031
+ * @namespace async-matchers
2032
+ */
2033
+ function AsyncExpectation(options) {
2034
+ var global = options.global || j$.getGlobal();
2035
+ this.util = options.util || { buildFailureMessage: function() {} };
2036
+ this.customEqualityTesters = options.customEqualityTesters || [];
2037
+ this.addExpectationResult = options.addExpectationResult || function(){};
2038
+ this.actual = options.actual;
2039
+ this.isNot = options.isNot;
2040
+
2041
+ if (!global.Promise) {
2042
+ throw new Error('expectAsync is unavailable because the environment does not support promises.');
2043
+ }
2044
+
2045
+ if (!j$.isPromise(this.actual)) {
2046
+ throw new Error('Expected expectAsync to be called with a promise.');
2047
+ }
2048
+
2049
+ ['toBeResolved', 'toBeRejected', 'toBeResolvedTo'].forEach(wrapCompare.bind(this));
2050
+ }
2051
+
2052
+ function wrapCompare(name) {
2053
+ var compare = this[name];
2054
+ this[name] = function() {
2055
+ var self = this;
2056
+ var args = Array.prototype.slice.call(arguments);
2057
+ args.unshift(this.actual);
2058
+
2059
+ // Capture the call stack here, before we go async, so that it will
2060
+ // contain frames that are relevant to the user instead of just parts
2061
+ // of Jasmine.
2062
+ var errorForStack = j$.util.errorWithStack();
2063
+
2064
+ return compare.apply(self, args).then(function(result) {
2065
+ var message;
2066
+
2067
+ if (self.isNot) {
2068
+ result.pass = !result.pass;
2069
+ }
2070
+
2071
+ args[0] = promiseForMessage;
2072
+ message = j$.Expectation.finalizeMessage(self.util, name, self.isNot, args, result);
2073
+
2074
+ self.addExpectationResult(result.pass, {
2075
+ matcherName: name,
2076
+ passed: result.pass,
2077
+ message: message,
2078
+ error: undefined,
2079
+ errorForStack: errorForStack,
2080
+ actual: self.actual
2081
+ });
2082
+ });
2083
+ };
2084
+ }
2085
+
2086
+ /**
2087
+ * Expect a promise to be resolved.
2088
+ * @function
2089
+ * @async
2090
+ * @name async-matchers#toBeResolved
2091
+ * @example
2092
+ * await expectAsync(aPromise).toBeResolved();
2093
+ * @example
2094
+ * return expectAsync(aPromise).toBeResolved();
2095
+ */
2096
+ AsyncExpectation.prototype.toBeResolved = function(actual) {
2097
+ return actual.then(
2098
+ function() { return {pass: true}; },
2099
+ function() { return {pass: false}; }
2100
+ );
2101
+ };
2102
+
2103
+ /**
2104
+ * Expect a promise to be rejected.
2105
+ * @function
2106
+ * @async
2107
+ * @name async-matchers#toBeRejected
2108
+ * @example
2109
+ * await expectAsync(aPromise).toBeRejected();
2110
+ * @example
2111
+ * return expectAsync(aPromise).toBeRejected();
2112
+ */
2113
+ AsyncExpectation.prototype.toBeRejected = function(actual) {
2114
+ return actual.then(
2115
+ function() { return {pass: false}; },
2116
+ function() { return {pass: true}; }
2117
+ );
2118
+ };
2119
+
2120
+ /**
2121
+ * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison.
2122
+ * @function
2123
+ * @async
2124
+ * @name async-matchers#toBeResolvedTo
2125
+ * @param {Object} expected - Value that the promise is expected to resolve to
2126
+ * @example
2127
+ * await expectAsync(aPromise).toBeResolvedTo({prop: 'value'});
2128
+ * @example
2129
+ * return expectAsync(aPromise).toBeResolvedTo({prop: 'value'});
2130
+ */
2131
+ AsyncExpectation.prototype.toBeResolvedTo = function(actualPromise, expectedValue) {
2132
+ var self = this;
2133
+
2134
+ function prefix(passed) {
2135
+ return 'Expected a promise ' +
2136
+ (passed ? 'not ' : '') +
2137
+ 'to be resolved to ' + j$.pp(expectedValue);
2138
+ }
2139
+
2140
+ return actualPromise.then(
2141
+ function(actualValue) {
2142
+ if (self.util.equals(actualValue, expectedValue, self.customEqualityTesters)) {
2143
+ return {
2144
+ pass: true,
2145
+ message: prefix(true) + '.'
2146
+ };
2147
+ } else {
2148
+ return {
2149
+ pass: false,
2150
+ message: prefix(false) + ' but it was resolved to ' + j$.pp(actualValue) + '.'
2151
+ };
2152
+ }
2153
+ },
2154
+ function() {
2155
+ return {
2156
+ pass: false,
2157
+ message: prefix(false) + ' but it was rejected.'
2158
+ };
2159
+ }
2160
+ );
2161
+ };
2162
+
2163
+
2164
+ AsyncExpectation.factory = function(options) {
2165
+ var expect = new AsyncExpectation(options);
2166
+
2167
+ options = j$.util.clone(options);
2168
+ options.isNot = true;
2169
+ expect.not = new AsyncExpectation(options);
2170
+
2171
+ return expect;
2172
+ };
2173
+
2174
+
2175
+ return AsyncExpectation;
2176
+ };
2177
+
1922
2178
  getJasmineRequireObj().CallTracker = function(j$) {
1923
2179
 
1924
2180
  /**
@@ -2107,6 +2363,7 @@ getJasmineRequireObj().clearStack = function(j$) {
2107
2363
 
2108
2364
  getJasmineRequireObj().Clock = function() {
2109
2365
 
2366
+ /* global process */
2110
2367
  var NODE_JS = typeof process !== 'undefined' && process.versions && typeof process.versions.node === 'string';
2111
2368
 
2112
2369
  /**
@@ -2496,7 +2753,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
2496
2753
  return null;
2497
2754
  }
2498
2755
 
2499
- var stackTrace = new j$.StackTrace(error.stack);
2756
+ var stackTrace = new j$.StackTrace(error);
2500
2757
  var lines = filterJasmine(stackTrace);
2501
2758
  var result = '';
2502
2759
 
@@ -2576,7 +2833,7 @@ getJasmineRequireObj().Expectation = function() {
2576
2833
  return function() {
2577
2834
  var args = Array.prototype.slice.call(arguments, 0),
2578
2835
  expected = args.slice(0),
2579
- message = '';
2836
+ message;
2580
2837
 
2581
2838
  args.unshift(this.actual);
2582
2839
 
@@ -2594,20 +2851,7 @@ getJasmineRequireObj().Expectation = function() {
2594
2851
  }
2595
2852
 
2596
2853
  var result = matcherCompare.apply(null, args);
2597
-
2598
- if (!result.pass) {
2599
- if (!result.message) {
2600
- args.unshift(this.isNot);
2601
- args.unshift(name);
2602
- message = this.util.buildFailureMessage.apply(null, args);
2603
- } else {
2604
- if (Object.prototype.toString.apply(result.message) === '[object Function]') {
2605
- message = result.message();
2606
- } else {
2607
- message = result.message;
2608
- }
2609
- }
2610
- }
2854
+ message = Expectation.finalizeMessage(this.util, name, this.isNot, args, result);
2611
2855
 
2612
2856
  if (expected.length == 1) {
2613
2857
  expected = expected[0];
@@ -2628,6 +2872,23 @@ getJasmineRequireObj().Expectation = function() {
2628
2872
  };
2629
2873
  };
2630
2874
 
2875
+ Expectation.finalizeMessage = function(util, name, isNot, args, result) {
2876
+ if (result.pass) {
2877
+ return '';
2878
+ } else if (result.message) {
2879
+ if (Object.prototype.toString.apply(result.message) === '[object Function]') {
2880
+ return result.message();
2881
+ } else {
2882
+ return result.message;
2883
+ }
2884
+ } else {
2885
+ args = args.slice();
2886
+ args.unshift(isNot);
2887
+ args.unshift(name);
2888
+ return util.buildFailureMessage.apply(null, args);
2889
+ }
2890
+ };
2891
+
2631
2892
  Expectation.addCoreMatchers = function(matchers) {
2632
2893
  var prototype = Expectation.prototype;
2633
2894
  for (var matcherName in matchers) {
@@ -2699,7 +2960,9 @@ getJasmineRequireObj().buildExpectationResult = function() {
2699
2960
 
2700
2961
  var error = options.error;
2701
2962
  if (!error) {
2702
- if (options.stack) {
2963
+ if (options.errorForStack) {
2964
+ error = options.errorForStack;
2965
+ } else if (options.stack) {
2703
2966
  error = options;
2704
2967
  } else {
2705
2968
  try {
@@ -2743,18 +3006,29 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
2743
3006
  }
2744
3007
  };
2745
3008
 
2746
- this.install = function install() {
2747
- if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
2748
- var originalHandlers = global.process.listeners('uncaughtException');
2749
- global.process.removeAllListeners('uncaughtException');
2750
- global.process.on('uncaughtException', onerror);
3009
+ this.originalHandlers = {};
3010
+ this.installOne_ = function installOne_(errorType) {
3011
+ this.originalHandlers[errorType] = global.process.listeners(errorType);
3012
+ global.process.removeAllListeners(errorType);
3013
+ global.process.on(errorType, onerror);
2751
3014
 
2752
- this.uninstall = function uninstall() {
2753
- global.process.removeListener('uncaughtException', onerror);
2754
- for (var i = 0; i < originalHandlers.length; i++) {
2755
- global.process.on('uncaughtException', originalHandlers[i]);
3015
+ this.uninstall = function uninstall() {
3016
+ var errorTypes = Object.keys(this.originalHandlers);
3017
+ for (var iType = 0; iType < errorTypes.length; iType++) {
3018
+ var errorType = errorTypes[iType];
3019
+ global.process.removeListener(errorType, onerror);
3020
+ for (var i = 0; i < this.originalHandlers[errorType].length; i++) {
3021
+ global.process.on(errorType, this.originalHandlers[errorType][i]);
2756
3022
  }
2757
- };
3023
+ delete this.originalHandlers[errorType];
3024
+ }
3025
+ };
3026
+ };
3027
+
3028
+ this.install = function install() {
3029
+ if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
3030
+ this.installOne_('uncaughtException');
3031
+ this.installOne_('unhandledRejection');
2758
3032
  } else {
2759
3033
  var originalHandler = global.onerror;
2760
3034
  global.onerror = onerror;
@@ -3038,8 +3312,14 @@ getJasmineRequireObj().matchersUtil = function(j$) {
3038
3312
  });
3039
3313
 
3040
3314
  for (i = 0; i < aLength || i < bLength; i++) {
3315
+ var formatter = false;
3041
3316
  diffBuilder.withPath(i, function() {
3042
- result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result;
3317
+ if (i >= bLength) {
3318
+ diffBuilder.record(a[i], void 0, actualArrayIsLongerFormatter);
3319
+ result = false;
3320
+ } else {
3321
+ result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result;
3322
+ }
3043
3323
  });
3044
3324
  }
3045
3325
  if (!result) {
@@ -3265,6 +3545,13 @@ getJasmineRequireObj().matchersUtil = function(j$) {
3265
3545
  ', but was ' + j$.pp(actual) + '.';
3266
3546
  }
3267
3547
 
3548
+ function actualArrayIsLongerFormatter(actual, expected, path) {
3549
+ return 'Unexpected ' +
3550
+ path + (path.depth() ? ' = ' : '') +
3551
+ j$.pp(actual) +
3552
+ ' in array.';
3553
+ }
3554
+
3268
3555
  function formatKeyValuePairs(obj) {
3269
3556
  var formatted = '';
3270
3557
  for (var key in obj) {
@@ -4617,8 +4904,8 @@ getJasmineRequireObj().pp = function(j$) {
4617
4904
  if (el.innerHTML === '') {
4618
4905
  this.append(el.outerHTML.replace(closingTag, ''));
4619
4906
  } else {
4620
- var tagEnd = el.outerHTML.indexOf(el.innerHTML);
4621
- this.append(el.outerHTML.substring(0, tagEnd));
4907
+ var tagEnd = el.outerHTML.indexOf('>');
4908
+ this.append(el.outerHTML.substring(0, tagEnd + 1));
4622
4909
  this.append('...' + closingTag);
4623
4910
  }
4624
4911
  };
@@ -4803,12 +5090,16 @@ getJasmineRequireObj().QueueRunner = function(j$) {
4803
5090
 
4804
5091
  self.globalErrors.pushListener(handleError);
4805
5092
 
4806
- if (queueableFn.timeout) {
5093
+ if (queueableFn.timeout !== undefined) {
5094
+ var timeoutInterval = queueableFn.timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
4807
5095
  timeoutId = self.setTimeout(function() {
4808
- var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
5096
+ var error = new Error(
5097
+ 'Timeout - Async callback was not invoked within ' + timeoutInterval + 'ms ' +
5098
+ (queueableFn.timeout ? '(custom timeout)' : '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)')
5099
+ );
4809
5100
  onException(error);
4810
5101
  next();
4811
- }, queueableFn.timeout());
5102
+ }, timeoutInterval);
4812
5103
  }
4813
5104
 
4814
5105
  try {
@@ -4857,7 +5148,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
4857
5148
  return;
4858
5149
  }
4859
5150
 
4860
- self.errored = result.errored;
5151
+ self.errored = self.errored || result.errored;
4861
5152
 
4862
5153
  if (this.completeOnFirstError && result.errored) {
4863
5154
  this.skipToCleanup(iterativeIndex);
@@ -5017,6 +5308,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5017
5308
  * @param {String} description Textual description of what this spec is checking
5018
5309
  * @param {implementationCallback} [testFunction] Function that contains the code of your test. If not provided the test will be `pending`.
5019
5310
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec.
5311
+ * @see async
5020
5312
  */
5021
5313
  it: function() {
5022
5314
  return env.it.apply(env, arguments);
@@ -5046,6 +5338,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5046
5338
  * @param {String} description Textual description of what this spec is checking.
5047
5339
  * @param {implementationCallback} testFunction Function that contains the code of your test.
5048
5340
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec.
5341
+ * @see async
5049
5342
  */
5050
5343
  fit: function() {
5051
5344
  return env.fit.apply(env, arguments);
@@ -5058,6 +5351,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5058
5351
  * @global
5059
5352
  * @param {implementationCallback} [function] Function that contains the code to setup your specs.
5060
5353
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeEach.
5354
+ * @see async
5061
5355
  */
5062
5356
  beforeEach: function() {
5063
5357
  return env.beforeEach.apply(env, arguments);
@@ -5070,6 +5364,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5070
5364
  * @global
5071
5365
  * @param {implementationCallback} [function] Function that contains the code to teardown your specs.
5072
5366
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterEach.
5367
+ * @see async
5073
5368
  */
5074
5369
  afterEach: function() {
5075
5370
  return env.afterEach.apply(env, arguments);
@@ -5084,6 +5379,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5084
5379
  * @global
5085
5380
  * @param {implementationCallback} [function] Function that contains the code to setup your specs.
5086
5381
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeAll.
5382
+ * @see async
5087
5383
  */
5088
5384
  beforeAll: function() {
5089
5385
  return env.beforeAll.apply(env, arguments);
@@ -5098,6 +5394,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5098
5394
  * @global
5099
5395
  * @param {implementationCallback} [function] Function that contains the code to teardown your specs.
5100
5396
  * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterAll.
5397
+ * @see async
5101
5398
  */
5102
5399
  afterAll: function() {
5103
5400
  return env.afterAll.apply(env, arguments);
@@ -5115,6 +5412,25 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5115
5412
  return env.expect(actual);
5116
5413
  },
5117
5414
 
5415
+ /**
5416
+ * Create an asynchronous expectation for a spec. Note that the matchers
5417
+ * that are provided by an asynchronous expectation all return promises
5418
+ * which must be either returned from the spec or waited for using `await`
5419
+ * in order for Jasmine to associate them with the correct spec.
5420
+ * @name expectAsync
5421
+ * @function
5422
+ * @global
5423
+ * @param {Object} actual - Actual computed value to test expectations against.
5424
+ * @return {async-matchers}
5425
+ * @example
5426
+ * await expectAsync(somePromise).toBeResolved();
5427
+ * @example
5428
+ * return expectAsync(somePromise).toBeResolved();
5429
+ */
5430
+ expectAsync: function(actual) {
5431
+ return env.expectAsync(actual);
5432
+ },
5433
+
5118
5434
  /**
5119
5435
  * Mark a spec as pending, expectation results will be ignored.
5120
5436
  * @name pending
@@ -5164,6 +5480,18 @@ getJasmineRequireObj().interface = function(jasmine, env) {
5164
5480
  return env.spyOnProperty(obj, methodName, accessType);
5165
5481
  },
5166
5482
 
5483
+ /**
5484
+ * Installs spies on all writable and configurable properties of an object.
5485
+ * @name spyOnProperty
5486
+ * @function
5487
+ * @global
5488
+ * @param {Object} obj - The object upon which to install the {@link Spy}s
5489
+ * @returns {Object} the spied object
5490
+ */
5491
+ spyOnAllFunctions: function(obj) {
5492
+ return env.spyOnAllFunctions(obj);
5493
+ },
5494
+
5167
5495
  jsApiReporter: new jasmine.JsApiReporter({
5168
5496
  timer: new jasmine.Timer()
5169
5497
  }),
@@ -5582,6 +5910,23 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
5582
5910
  return spy;
5583
5911
  };
5584
5912
 
5913
+ this.spyOnAllFunctions = function(obj) {
5914
+ if (j$.util.isUndefined(obj)) {
5915
+ throw new Error('spyOnAllFunctions could not find an object to spy upon');
5916
+ }
5917
+
5918
+ for (var prop in obj) {
5919
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && obj[prop] instanceof Function) {
5920
+ var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
5921
+ if ((descriptor.writable || descriptor.set) && descriptor.configurable) {
5922
+ this.spyOn(obj, prop);
5923
+ }
5924
+ }
5925
+ }
5926
+
5927
+ return obj;
5928
+ };
5929
+
5585
5930
  this.clearSpies = function() {
5586
5931
  var spies = currentSpies();
5587
5932
  for (var i = spies.length - 1; i >= 0; i--) {
@@ -5726,15 +6071,16 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
5726
6071
  };
5727
6072
 
5728
6073
  getJasmineRequireObj().StackTrace = function(j$) {
5729
- function StackTrace(rawTrace) {
5730
- var lines = rawTrace
6074
+ function StackTrace(error) {
6075
+ var lines = error.stack
5731
6076
  .split('\n')
5732
6077
  .filter(function(line) { return line !== ''; });
5733
6078
 
5734
- if (lines[0].match(/^Error/)) {
5735
- this.message = lines.shift();
5736
- } else {
5737
- this.message = undefined;
6079
+ var extractResult = extractMessage(error.message, lines);
6080
+
6081
+ if (extractResult) {
6082
+ this.message = extractResult.message;
6083
+ lines = extractResult.remainder;
5738
6084
  }
5739
6085
 
5740
6086
  var parseResult = tryParseFrames(lines);
@@ -5802,6 +6148,34 @@ getJasmineRequireObj().StackTrace = function(j$) {
5802
6148
  }
5803
6149
  }
5804
6150
  }
6151
+
6152
+ function extractMessage(message, stackLines) {
6153
+ var len = messagePrefixLength(message, stackLines);
6154
+
6155
+ if (len > 0) {
6156
+ return {
6157
+ message: stackLines.slice(0, len).join('\n'),
6158
+ remainder: stackLines.slice(len)
6159
+ };
6160
+ }
6161
+ }
6162
+
6163
+ function messagePrefixLength(message, stackLines) {
6164
+ if (!stackLines[0].match(/^Error/)) {
6165
+ return 0;
6166
+ }
6167
+
6168
+ var messageLines = message.split('\n');
6169
+ var i;
6170
+
6171
+ for (i = 1; i < messageLines.length; i++) {
6172
+ if (messageLines[i] !== stackLines[i]) {
6173
+ return 0;
6174
+ }
6175
+ }
6176
+
6177
+ return messageLines.length;
6178
+ }
5805
6179
 
5806
6180
  return StackTrace;
5807
6181
  };
@@ -5813,6 +6187,7 @@ getJasmineRequireObj().Suite = function(j$) {
5813
6187
  this.parentSuite = attrs.parentSuite;
5814
6188
  this.description = attrs.description;
5815
6189
  this.expectationFactory = attrs.expectationFactory;
6190
+ this.asyncExpectationFactory = attrs.asyncExpectationFactory;
5816
6191
  this.expectationResultFactory = attrs.expectationResultFactory;
5817
6192
  this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
5818
6193
 
@@ -5845,6 +6220,10 @@ getJasmineRequireObj().Suite = function(j$) {
5845
6220
  return this.expectationFactory(actual, this);
5846
6221
  };
5847
6222
 
6223
+ Suite.prototype.expectAsync = function(actual) {
6224
+ return this.asyncExpectationFactory(actual, this);
6225
+ };
6226
+
5848
6227
  Suite.prototype.getFullName = function() {
5849
6228
  var fullName = [];
5850
6229
  for (var parentSuite = this; parentSuite; parentSuite = parentSuite.parentSuite) {
@@ -5971,6 +6350,7 @@ getJasmineRequireObj().Suite = function(j$) {
5971
6350
  };
5972
6351
 
5973
6352
  if (typeof window == void 0 && typeof exports == 'object') {
6353
+ /* globals exports */
5974
6354
  exports.Suite = jasmineRequire.Suite;
5975
6355
  }
5976
6356
 
@@ -6173,8 +6553,11 @@ getJasmineRequireObj().TreeProcessor = function() {
6173
6553
 
6174
6554
  queueRunnerFactory({
6175
6555
  onComplete: function () {
6556
+ var args = Array.prototype.slice.call(arguments, [0]);
6176
6557
  node.cleanupBeforeAfter();
6177
- nodeComplete(node, node.getResult(), done);
6558
+ nodeComplete(node, node.getResult(), function() {
6559
+ done.apply(undefined, args);
6560
+ });
6178
6561
  },
6179
6562
  queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
6180
6563
  userContext: node.sharedUserContext(),
@@ -6230,5 +6613,5 @@ getJasmineRequireObj().UserContext = function(j$) {
6230
6613
  };
6231
6614
 
6232
6615
  getJasmineRequireObj().version = function() {
6233
- return '3.1.0';
6616
+ return '3.2.0';
6234
6617
  };
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "3.1.0"
7
+ VERSION = "3.2.0"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Van Hove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project: jasmine-core
117
- rubygems_version: 2.6.11
117
+ rubygems_version: 2.7.3
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: JavaScript BDD framework