jasmine-core 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/boot/node_boot.js +1 -1
  3. data/lib/jasmine-core/jasmine-html.js +0 -35
  4. data/lib/jasmine-core/jasmine.css +0 -6
  5. data/lib/jasmine-core/jasmine.js +246 -36
  6. data/lib/jasmine-core/node_boot.js +1 -1
  7. data/lib/jasmine-core/version.rb +1 -1
  8. metadata +3 -88
  9. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  10. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  11. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -710
  12. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -286
  13. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  14. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -120
  15. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -46
  16. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  17. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  18. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  19. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  20. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  21. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -332
  22. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -670
  23. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -140
  24. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -407
  25. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -364
  26. data/lib/jasmine-core/spec/core/SpySpec.js +0 -177
  27. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -202
  28. data/lib/jasmine-core/spec/core/StackTraceSpec.js +0 -166
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -123
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  31. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -794
  32. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  33. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -105
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -91
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  38. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -99
  39. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  40. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  41. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -200
  42. data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +0 -138
  43. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2344
  44. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -976
  45. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  46. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  47. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  48. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -645
  49. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  50. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  51. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  52. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  53. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  54. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  55. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  56. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  57. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  58. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  59. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  60. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  61. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  62. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  63. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  64. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  65. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -785
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  67. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  68. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  69. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  70. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  71. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  72. data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +0 -73
  73. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  74. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -15
  75. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  76. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  77. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  78. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  79. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  80. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -6
  81. data/lib/jasmine-core/spec/helpers/integrationMatchers.js +0 -43
  82. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -30
  83. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -1261
  84. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  85. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  86. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -27
  87. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  88. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  89. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -39
  90. data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +0 -48
  91. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  92. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  93. data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e5647f35a2c17871621df2d1822a77c638e2a84
4
- data.tar.gz: 0d30ae54baae843527b0e057715e55766df4b01d
3
+ metadata.gz: 98e75bc149c63002aece96ae344bb358e807d187
4
+ data.tar.gz: 454fb581fdf962b099c7ca2f827aee46f20e633f
5
5
  SHA512:
6
- metadata.gz: 366cce7b5d79ec3defff32ac37246dd92df9418e81c2b9f575f92d58de658337c2b7fab46d5c4f83902ae8165a66f1628e80cdc171394107e851cd93c6742219
7
- data.tar.gz: b0b62b54f3d7c85d5289227fa5f40417a6e59c481848972e50425ce1215e97f1cccbe3dc737ea30f016ad2695d591e0e5ad48b6a5546d15b1a292e49e7f5b503
6
+ metadata.gz: 8afeb955927ee74c2371ade5308627d21beb8952061a619f9190e8feef3b92a15613dbd5cc2348a4df19019ac07bdfefb2e170db66035d074854d7965f870ee9
7
+ data.tar.gz: 6d8e478948454fe8c03c990218450f46d0535fb5e7c4daa2e3668e0c6fe0fa15a1e488deed163e68f3ea496913d18dd16060d4018bb8bd0d6a3ace672588b04e
@@ -1,7 +1,7 @@
1
1
  module.exports = function(jasmineRequire) {
2
2
  var jasmine = jasmineRequire.core(jasmineRequire);
3
3
 
4
- var env = jasmine.getEnv();
4
+ var env = jasmine.getEnv({suppressLoadErrors: true});
5
5
 
6
6
  var jasmineInterface = jasmineRequire.interface(jasmine, env);
7
7
 
@@ -25,7 +25,6 @@ jasmineRequire.html = function(j$) {
25
25
  j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
26
26
  j$.QueryString = jasmineRequire.QueryString();
27
27
  j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
28
- j$.matchers.toHaveClass = jasmineRequire.toHaveClass(j$);
29
28
  };
30
29
 
31
30
  jasmineRequire.HtmlReporter = function(j$) {
@@ -600,37 +599,3 @@ jasmineRequire.QueryString = function() {
600
599
 
601
600
  return QueryString;
602
601
  };
603
-
604
- jasmineRequire.toHaveClass = function(j$) {
605
- /**
606
- * {@link expect} the actual value to be a DOM element that has the expected class
607
- * @function
608
- * @name matchers#toHaveClass
609
- * @param {Object} expected - The class name to test for
610
- * @example
611
- * var el = document.createElement('div');
612
- * el.className = 'foo bar baz';
613
- * expect(el).toHaveClass('bar');
614
- */
615
- function toHaveClass(util, customEqualityTesters) {
616
- return {
617
- compare: function(actual, expected) {
618
- if (!isElement(actual)) {
619
- throw new Error(j$.pp(actual) + ' is not a DOM element');
620
- }
621
-
622
- return {
623
- pass: actual.classList.contains(expected)
624
- };
625
- }
626
- };
627
- }
628
-
629
- function isElement(maybeEl) {
630
- return maybeEl &&
631
- maybeEl.classList &&
632
- j$.isFunction_(maybeEl.classList.contains);
633
- }
634
-
635
- return toHaveClass;
636
- };
@@ -33,13 +33,7 @@ body { overflow-y: scroll; }
33
33
  .jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
34
34
  .jasmine_html-reporter .jasmine-bar.jasmine-incomplete { background-color: #bababa; }
35
35
  .jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
36
- <<<<<<< HEAD
37
- ||||||| merged common ancestors
38
- .jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
39
- =======
40
- .jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
41
36
  .jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; color: #333; }
42
- >>>>>>> master
43
37
  .jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
44
38
  .jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
45
39
  .jasmine_html-reporter .jasmine-bar a { color: white; }
@@ -85,6 +85,11 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
85
85
  j$.ObjectPath = jRequire.ObjectPath(j$);
86
86
  j$.GlobalErrors = jRequire.GlobalErrors(j$);
87
87
 
88
+ j$.Truthy = jRequire.Truthy(j$);
89
+ j$.Falsy = jRequire.Falsy(j$);
90
+ j$.Empty = jRequire.Empty(j$);
91
+ j$.NotEmpty = jRequire.NotEmpty(j$);
92
+
88
93
  j$.matchers = jRequire.requireMatchers(jRequire, j$);
89
94
 
90
95
  return j$;
@@ -116,6 +121,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
116
121
  'toHaveBeenCalledBefore',
117
122
  'toHaveBeenCalledTimes',
118
123
  'toHaveBeenCalledWith',
124
+ 'toHaveClass',
119
125
  'toMatch',
120
126
  'toThrow',
121
127
  'toThrowError',
@@ -254,8 +260,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
254
260
  return func.name;
255
261
  }
256
262
 
257
- var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/) ||
258
- func.toString().match(/^\s*\[object\s*(\w*)Constructor\]/);
263
+ var matches = func.toString().match(/^\s*function\s*(\w+)\s*\(/) ||
264
+ func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/);
259
265
 
260
266
  return matches ? matches[1] : '<anonymous>';
261
267
  };
@@ -281,6 +287,38 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
281
287
  return new j$.Anything();
282
288
  };
283
289
 
290
+ /**
291
+ * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
292
+ * that will succeed if the actual value being compared is `true` or anything truthy.
293
+ * @name jasmine.truthy
294
+ * @function
295
+ */
296
+ j$.truthy = function() {return new j$.Truthy();};
297
+
298
+ /**
299
+ * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
300
+ * that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
301
+ * @name jasmine.falsy
302
+ * @function
303
+ */
304
+ j$.falsy = function() {return new j$.Falsy();};
305
+
306
+ /**
307
+ * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
308
+ * that will succeed if the actual value being compared is empty.
309
+ * @name jasmine.empty
310
+ * @function
311
+ */
312
+ j$.empty = function() {return new j$.Empty();};
313
+
314
+ /**
315
+ * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
316
+ * that will succeed if the actual value being compared is not empty.
317
+ * @name jasmine.notEmpty
318
+ * @function
319
+ */
320
+ j$.notEmpty = function() {return new j$.NotEmpty();};
321
+
284
322
  /**
285
323
  * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
286
324
  * that will succeed if the actual value being compared contains at least the keys and values.
@@ -641,8 +679,11 @@ getJasmineRequireObj().Spec = function(j$) {
641
679
  return this.getSpecName(this);
642
680
  };
643
681
 
644
- Spec.prototype.addDeprecationWarning = function(msg) {
645
- this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
682
+ Spec.prototype.addDeprecationWarning = function(deprecation) {
683
+ if (typeof deprecation === 'string') {
684
+ deprecation = { message: deprecation };
685
+ }
686
+ this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
646
687
  };
647
688
 
648
689
  var extractCustomPendingMessage = function(e) {
@@ -753,17 +794,29 @@ getJasmineRequireObj().Env = function(j$) {
753
794
  return currentSpec || currentSuite();
754
795
  };
755
796
 
756
- var globalErrors = new j$.GlobalErrors();
757
- globalErrors.install();
758
- globalErrors.pushListener(function(message, filename, lineno) {
759
- topSuite.result.failedExpectations.push({
760
- passed: false,
761
- globalErrorType: 'load',
762
- message: message,
763
- filename: filename,
764
- lineno: lineno
797
+ var globalErrors = null;
798
+
799
+ var installGlobalErrors = function() {
800
+ if (globalErrors) {
801
+ return;
802
+ }
803
+
804
+ globalErrors = new j$.GlobalErrors();
805
+ globalErrors.install();
806
+ };
807
+
808
+ if (!options.suppressLoadErrors) {
809
+ installGlobalErrors();
810
+ globalErrors.pushListener(function(message, filename, lineno) {
811
+ topSuite.result.failedExpectations.push({
812
+ passed: false,
813
+ globalErrorType: 'load',
814
+ message: message,
815
+ filename: filename,
816
+ lineno: lineno
817
+ });
765
818
  });
766
- });
819
+ }
767
820
 
768
821
  this.specFilter = function() {
769
822
  return true;
@@ -908,18 +961,11 @@ getJasmineRequireObj().Env = function(j$) {
908
961
  return seed;
909
962
  };
910
963
 
911
- this.suppressLoadErrors = function() {
912
- if (handlingLoadErrors) {
913
- globalErrors.popListener();
914
- }
915
- handlingLoadErrors = false;
916
- };
917
-
918
- this.deprecated = function(msg) {
964
+ this.deprecated = function(deprecation) {
919
965
  var runnable = currentRunnable() || topSuite;
920
- runnable.addDeprecationWarning(msg);
921
- if(typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
922
- console.error('DEPRECATION: ' + msg);
966
+ runnable.addDeprecationWarning(deprecation);
967
+ if(typeof console !== 'undefined' && typeof console.error === 'function') {
968
+ console.error('DEPRECATION:', deprecation);
923
969
  }
924
970
  };
925
971
 
@@ -967,6 +1013,8 @@ getJasmineRequireObj().Env = function(j$) {
967
1013
  * @function
968
1014
  * @name Reporter#jasmineStarted
969
1015
  * @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run
1016
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
970
1018
  */
971
1019
  'jasmineStarted',
972
1020
  /**
@@ -974,6 +1022,8 @@ getJasmineRequireObj().Env = function(j$) {
974
1022
  * @function
975
1023
  * @name Reporter#jasmineDone
976
1024
  * @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running.
1025
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
977
1027
  */
978
1028
  'jasmineDone',
979
1029
  /**
@@ -981,6 +1031,8 @@ getJasmineRequireObj().Env = function(j$) {
981
1031
  * @function
982
1032
  * @name Reporter#suiteStarted
983
1033
  * @param {SuiteResult} result Information about the individual {@link describe} being run
1034
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
984
1036
  */
985
1037
  'suiteStarted',
986
1038
  /**
@@ -990,6 +1042,8 @@ getJasmineRequireObj().Env = function(j$) {
990
1042
  * @function
991
1043
  * @name Reporter#suiteDone
992
1044
  * @param {SuiteResult} result
1045
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
993
1047
  */
994
1048
  'suiteDone',
995
1049
  /**
@@ -997,6 +1051,8 @@ getJasmineRequireObj().Env = function(j$) {
997
1051
  * @function
998
1052
  * @name Reporter#specStarted
999
1053
  * @param {SpecResult} result Information about the individual {@link it} being run
1054
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1000
1056
  */
1001
1057
  'specStarted',
1002
1058
  /**
@@ -1006,13 +1062,15 @@ getJasmineRequireObj().Env = function(j$) {
1006
1062
  * @function
1007
1063
  * @name Reporter#specDone
1008
1064
  * @param {SpecResult} result
1065
+ * @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
+ * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
1009
1067
  */
1010
1068
  'specDone'
1011
1069
  ], queueRunnerFactory);
1012
1070
 
1013
1071
  this.execute = function(runnablesToRun) {
1014
1072
  var self = this;
1015
- this.suppressLoadErrors();
1073
+ installGlobalErrors();
1016
1074
 
1017
1075
  if(!runnablesToRun) {
1018
1076
  if (focusedRunnables.length) {
@@ -1707,6 +1765,74 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
1707
1765
  return ArrayWithExactContents;
1708
1766
  };
1709
1767
 
1768
+ getJasmineRequireObj().Empty = function (j$) {
1769
+
1770
+ function Empty() {}
1771
+
1772
+ Empty.prototype.asymmetricMatch = function (other) {
1773
+ if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
1774
+ return other.length === 0;
1775
+ }
1776
+
1777
+ if (j$.isMap(other) || j$.isSet(other)) {
1778
+ return other.size === 0;
1779
+ }
1780
+
1781
+ if (j$.isObject_(other)) {
1782
+ return Object.keys(other).length === 0;
1783
+ }
1784
+ return false;
1785
+ };
1786
+
1787
+ Empty.prototype.jasmineToString = function () {
1788
+ return '<jasmine.empty>';
1789
+ };
1790
+
1791
+ return Empty;
1792
+ };
1793
+
1794
+ getJasmineRequireObj().Falsy = function(j$) {
1795
+
1796
+ function Falsy() {}
1797
+
1798
+ Falsy.prototype.asymmetricMatch = function(other) {
1799
+ return !other;
1800
+ };
1801
+
1802
+ Falsy.prototype.jasmineToString = function() {
1803
+ return '<jasmine.falsy>';
1804
+ };
1805
+
1806
+ return Falsy;
1807
+ };
1808
+
1809
+ getJasmineRequireObj().NotEmpty = function (j$) {
1810
+
1811
+ function NotEmpty() {}
1812
+
1813
+ NotEmpty.prototype.asymmetricMatch = function (other) {
1814
+ if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
1815
+ return other.length !== 0;
1816
+ }
1817
+
1818
+ if (j$.isMap(other) || j$.isSet(other)) {
1819
+ return other.size !== 0;
1820
+ }
1821
+
1822
+ if (j$.isObject_(other)) {
1823
+ return Object.keys(other).length !== 0;
1824
+ }
1825
+
1826
+ return false;
1827
+ };
1828
+
1829
+ NotEmpty.prototype.jasmineToString = function () {
1830
+ return '<jasmine.notEmpty>';
1831
+ };
1832
+
1833
+ return NotEmpty;
1834
+ };
1835
+
1710
1836
  getJasmineRequireObj().ObjectContaining = function(j$) {
1711
1837
 
1712
1838
  function ObjectContaining(sample) {
@@ -1778,6 +1904,21 @@ getJasmineRequireObj().StringMatching = function(j$) {
1778
1904
  return StringMatching;
1779
1905
  };
1780
1906
 
1907
+ getJasmineRequireObj().Truthy = function(j$) {
1908
+
1909
+ function Truthy() {}
1910
+
1911
+ Truthy.prototype.asymmetricMatch = function(other) {
1912
+ return !!other;
1913
+ };
1914
+
1915
+ Truthy.prototype.jasmineToString = function() {
1916
+ return '<jasmine.truthy>';
1917
+ };
1918
+
1919
+ return Truthy;
1920
+ };
1921
+
1781
1922
  getJasmineRequireObj().CallTracker = function(j$) {
1782
1923
 
1783
1924
  /**
@@ -2357,18 +2498,22 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
2357
2498
 
2358
2499
  var stackTrace = new j$.StackTrace(error.stack);
2359
2500
  var lines = filterJasmine(stackTrace);
2501
+ var result = '';
2360
2502
 
2361
2503
  if (stackTrace.message) {
2362
2504
  lines.unshift(stackTrace.message);
2363
2505
  }
2364
2506
 
2365
- return lines.join('\n');
2507
+ result += formatProperties(error);
2508
+ result += lines.join('\n');
2509
+
2510
+ return result;
2366
2511
  };
2367
2512
 
2368
2513
  function filterJasmine(stackTrace) {
2369
2514
  var result = [],
2370
2515
  jasmineMarker = stackTrace.style === 'webkit' ? '<Jasmine>' : ' at <Jasmine>';
2371
-
2516
+
2372
2517
  stackTrace.frames.forEach(function(frame) {
2373
2518
  if (frame.file && frame.file !== jasmineFile) {
2374
2519
  result.push(frame.raw);
@@ -2376,9 +2521,33 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
2376
2521
  result.push(jasmineMarker);
2377
2522
  }
2378
2523
  });
2379
-
2524
+
2380
2525
  return result;
2381
2526
  }
2527
+
2528
+ function formatProperties(error) {
2529
+ if (!(error instanceof Object)) {
2530
+ return;
2531
+ }
2532
+
2533
+ var ignored = ['name', 'message', 'stack', 'fileName', 'sourceURL', 'line', 'lineNumber', 'column', 'description'];
2534
+ var result = {};
2535
+ var empty = true;
2536
+
2537
+ for (var prop in error) {
2538
+ if (j$.util.arrayContains(ignored, prop)) {
2539
+ continue;
2540
+ }
2541
+ result[prop] = error[prop];
2542
+ empty = false;
2543
+ }
2544
+
2545
+ if (!empty) {
2546
+ return 'error properties: ' + j$.pp(result) + '\n';
2547
+ }
2548
+
2549
+ return '';
2550
+ }
2382
2551
  }
2383
2552
 
2384
2553
  return ExceptionFormatter;
@@ -2530,10 +2699,14 @@ getJasmineRequireObj().buildExpectationResult = function() {
2530
2699
 
2531
2700
  var error = options.error;
2532
2701
  if (!error) {
2533
- try {
2534
- throw new Error(message());
2535
- } catch (e) {
2536
- error = e;
2702
+ if (options.stack) {
2703
+ error = options;
2704
+ } else {
2705
+ try {
2706
+ throw new Error(message());
2707
+ } catch (e) {
2708
+ error = e;
2709
+ }
2537
2710
  }
2538
2711
  }
2539
2712
  return stackFormatter(error);
@@ -3766,6 +3939,40 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
3766
3939
  return toHaveBeenCalledWith;
3767
3940
  };
3768
3941
 
3942
+ getJasmineRequireObj().toHaveClass = function(j$) {
3943
+ /**
3944
+ * {@link expect} the actual value to be a DOM element that has the expected class
3945
+ * @function
3946
+ * @name matchers#toHaveClass
3947
+ * @param {Object} expected - The class name to test for
3948
+ * @example
3949
+ * var el = document.createElement('div');
3950
+ * el.className = 'foo bar baz';
3951
+ * expect(el).toHaveClass('bar');
3952
+ */
3953
+ function toHaveClass(util, customEqualityTesters) {
3954
+ return {
3955
+ compare: function(actual, expected) {
3956
+ if (!isElement(actual)) {
3957
+ throw new Error(j$.pp(actual) + ' is not a DOM element');
3958
+ }
3959
+
3960
+ return {
3961
+ pass: actual.classList.contains(expected)
3962
+ };
3963
+ }
3964
+ };
3965
+ }
3966
+
3967
+ function isElement(maybeEl) {
3968
+ return maybeEl &&
3969
+ maybeEl.classList &&
3970
+ j$.isFunction_(maybeEl.classList.contains);
3971
+ }
3972
+
3973
+ return toHaveClass;
3974
+ };
3975
+
3769
3976
  getJasmineRequireObj().toMatch = function(j$) {
3770
3977
 
3771
3978
  var getErrorMsg = j$.formatErrorMsg('<toMatch>', 'expect(<expectation>).toMatch(<string> || <regexp>)');
@@ -5749,8 +5956,11 @@ getJasmineRequireObj().Suite = function(j$) {
5749
5956
  }
5750
5957
  };
5751
5958
 
5752
- Suite.prototype.addDeprecationWarning = function(msg) {
5753
- this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
5959
+ Suite.prototype.addDeprecationWarning = function(deprecation) {
5960
+ if (typeof deprecation === 'string') {
5961
+ deprecation = { message: deprecation };
5962
+ }
5963
+ this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
5754
5964
  };
5755
5965
 
5756
5966
  function isFailure(args) {
@@ -6020,5 +6230,5 @@ getJasmineRequireObj().UserContext = function(j$) {
6020
6230
  };
6021
6231
 
6022
6232
  getJasmineRequireObj().version = function() {
6023
- return '3.0.0';
6233
+ return '3.1.0';
6024
6234
  };