jasmine-core 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,7 +32,7 @@ Microsoft Edge) as well as Node.
32
32
  | Node | 20, 22, 24 |
33
33
  | Safari | 26* |
34
34
  | Chrome | Evergreen |
35
- | Firefox | Evergreen, 102*, 115*, 128*, 140 |
35
+ | Firefox | Evergreen, 140 |
36
36
  | Edge | Evergreen |
37
37
 
38
38
  For evergreen browsers, each version of Jasmine is tested against the version of the browser that is available to us
@@ -38,8 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38
38
  *
39
39
  * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
40
40
  */
41
- const jasmine = jasmineRequire.core(jasmineRequire),
42
- global = jasmine.getGlobal();
41
+ const jasmine = jasmineRequire.core(jasmineRequire);
42
+ const global = jasmine.getGlobal();
43
43
  global.jasmine = jasmine;
44
44
 
45
45
  /**
@@ -707,9 +707,9 @@ jasmineRequire.Banner = function(j$) {
707
707
  };
708
708
  }
709
709
 
710
- const optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
711
- optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
712
- isOpen = /\bjasmine-open\b/;
710
+ const optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger');
711
+ const optionsPayload = optionsMenuDom.querySelector('.jasmine-payload');
712
+ const isOpen = /\bjasmine-open\b/;
713
713
 
714
714
  optionsTrigger.onclick = function() {
715
715
  if (isOpen.test(optionsPayload.className)) {
@@ -153,43 +153,43 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
153
153
  'use strict';
154
154
 
155
155
  const availableMatchers = [
156
- 'nothing',
157
- 'toBe',
158
- 'toBeCloseTo',
159
- 'toBeDefined',
160
- 'toBeInstanceOf',
161
- 'toBeFalse',
162
- 'toBeFalsy',
163
- 'toBeGreaterThan',
164
- 'toBeGreaterThanOrEqual',
165
- 'toBeLessThan',
166
- 'toBeLessThanOrEqual',
167
- 'toBeNaN',
168
- 'toBeNegativeInfinity',
169
- 'toBeNull',
170
- 'toBePositiveInfinity',
171
- 'toBeTrue',
172
- 'toBeTruthy',
173
- 'toBeUndefined',
174
- 'toBeNullish',
175
- 'toContain',
176
- 'toEqual',
177
- 'toHaveSize',
178
- 'toHaveBeenCalled',
179
- 'toHaveBeenCalledBefore',
180
- 'toHaveBeenCalledOnceWith',
181
- 'toHaveBeenCalledTimes',
182
- 'toHaveBeenCalledWith',
183
- 'toHaveClass',
184
- 'toHaveClasses',
185
- 'toHaveSpyInteractions',
186
- 'toHaveNoOtherSpyInteractions',
187
- 'toMatch',
188
- 'toThrow',
189
- 'toThrowError',
190
- 'toThrowMatching'
191
- ],
192
- matchers = {};
156
+ 'nothing',
157
+ 'toBe',
158
+ 'toBeCloseTo',
159
+ 'toBeDefined',
160
+ 'toBeInstanceOf',
161
+ 'toBeFalse',
162
+ 'toBeFalsy',
163
+ 'toBeGreaterThan',
164
+ 'toBeGreaterThanOrEqual',
165
+ 'toBeLessThan',
166
+ 'toBeLessThanOrEqual',
167
+ 'toBeNaN',
168
+ 'toBeNegativeInfinity',
169
+ 'toBeNull',
170
+ 'toBePositiveInfinity',
171
+ 'toBeTrue',
172
+ 'toBeTruthy',
173
+ 'toBeUndefined',
174
+ 'toBeNullish',
175
+ 'toContain',
176
+ 'toEqual',
177
+ 'toHaveSize',
178
+ 'toHaveBeenCalled',
179
+ 'toHaveBeenCalledBefore',
180
+ 'toHaveBeenCalledOnceWith',
181
+ 'toHaveBeenCalledTimes',
182
+ 'toHaveBeenCalledWith',
183
+ 'toHaveClass',
184
+ 'toHaveClasses',
185
+ 'toHaveSpyInteractions',
186
+ 'toHaveNoOtherSpyInteractions',
187
+ 'toMatch',
188
+ 'toThrow',
189
+ 'toThrowError',
190
+ 'toThrowMatching'
191
+ ];
192
+ const matchers = {};
193
193
 
194
194
  for (const name of availableMatchers) {
195
195
  matchers[name] = jRequire[name](j$);
@@ -733,8 +733,8 @@ getJasmineRequireObj().util = function(j$) {
733
733
 
734
734
  util.cloneArgs = function(args) {
735
735
  return Array.from(args).map(function(arg) {
736
- const str = Object.prototype.toString.apply(arg),
737
- primitives = /^\[object (Boolean|String|RegExp|Number)/;
736
+ const str = Object.prototype.toString.apply(arg);
737
+ const primitives = /^\[object (Boolean|String|RegExp|Number)/;
738
738
 
739
739
  // All falsey values are either primitives, `null`, or `undefined.
740
740
  if (!arg || str.match(primitives)) {
@@ -748,8 +748,8 @@ getJasmineRequireObj().util = function(j$) {
748
748
  };
749
749
 
750
750
  util.getPropertyDescriptor = function(obj, methodName) {
751
- let descriptor,
752
- proto = obj;
751
+ let descriptor;
752
+ let proto = obj;
753
753
 
754
754
  do {
755
755
  descriptor = Object.getOwnPropertyDescriptor(proto, methodName);
@@ -1175,10 +1175,12 @@ getJasmineRequireObj().Spec = function(j$) {
1175
1175
  }
1176
1176
 
1177
1177
  const extractCustomPendingMessage = function(e) {
1178
- const fullMessage = e.toString(),
1179
- boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
1180
- boilerplateEnd =
1181
- boilerplateStart + Spec.pendingSpecExceptionMessage.length;
1178
+ const fullMessage = e.toString();
1179
+ const boilerplateStart = fullMessage.indexOf(
1180
+ Spec.pendingSpecExceptionMessage
1181
+ );
1182
+ const boilerplateEnd =
1183
+ boilerplateStart + Spec.pendingSpecExceptionMessage.length;
1182
1184
 
1183
1185
  return fullMessage.slice(boilerplateEnd);
1184
1186
  };
@@ -2139,8 +2141,8 @@ getJasmineRequireObj().JsApiReporter = function(j$) {
2139
2141
  return status;
2140
2142
  };
2141
2143
 
2142
- const suites = [],
2143
- suites_hash = {};
2144
+ const suites = [];
2145
+ const suites_hash = {};
2144
2146
 
2145
2147
  this.suiteStarted = function(result) {
2146
2148
  suites_hash[result.id] = result;
@@ -5122,6 +5124,71 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
5122
5124
  }
5123
5125
  };
5124
5126
 
5127
+ getJasmineRequireObj().toBeRejectedWithMatching = function(j$) {
5128
+ 'use strict';
5129
+
5130
+ const usageError = j$.private.formatErrorMsg(
5131
+ '<toBeRejectedWithMatching>',
5132
+ 'expect(function() {<expectation>}).toBeRejectedWithMatching(<Predicate>)'
5133
+ );
5134
+
5135
+ /**
5136
+ * Expect a promise to be rejected with a value matching a predicate.
5137
+ * @function
5138
+ * @async
5139
+ * @name async-matchers#toBeRejectedWithMatching
5140
+ * @since 6.2.0
5141
+ * @param {Function} predicate - A function that takes the rejected promise value as its parameter and returns true if it matches.
5142
+ * @example
5143
+ * await expectAsync(aPromise).toBeRejectedWithMatching((error) => error.message === 'Some error');
5144
+ * @example
5145
+ * return expectAsync(aPromise).toBeRejectedWithMatching((error) => error.message === 'Some error');
5146
+ */
5147
+ return function toBeRejectedWithMatching() {
5148
+ return {
5149
+ compare: function(actualPromise, predicate) {
5150
+ if (!j$.private.isPromiseLike(actualPromise)) {
5151
+ throw new Error(
5152
+ `Expected toBeRejectedWithMatching to be called on a promise but was on a ${typeof actualPromise}.`
5153
+ );
5154
+ }
5155
+
5156
+ if (typeof predicate !== 'function') {
5157
+ throw new Error(usageError('Predicate is not a Function'));
5158
+ }
5159
+
5160
+ function prefix(passed) {
5161
+ return (
5162
+ 'Expected a promise ' +
5163
+ (passed ? 'not ' : '') +
5164
+ 'to be rejected matching a predicate'
5165
+ );
5166
+ }
5167
+
5168
+ return actualPromise.then(
5169
+ function() {
5170
+ return {
5171
+ pass: false,
5172
+ message: prefix(false) + ', but it was resolved.'
5173
+ };
5174
+ },
5175
+ function(actualValue) {
5176
+ const result = predicate(actualValue);
5177
+ return {
5178
+ pass: Boolean(result),
5179
+ message:
5180
+ prefix(result) +
5181
+ ', but the predicate returned "' +
5182
+ result +
5183
+ '".'
5184
+ };
5185
+ }
5186
+ );
5187
+ }
5188
+ };
5189
+ };
5190
+ };
5191
+
5125
5192
  getJasmineRequireObj().toBeResolved = function(j$) {
5126
5193
  'use strict';
5127
5194
 
@@ -5426,14 +5493,14 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
5426
5493
  };
5427
5494
 
5428
5495
  MatchersUtil.prototype.buildFailureMessage = function() {
5429
- const args = Array.prototype.slice.call(arguments, 0),
5430
- matcherName = args[0],
5431
- isNot = args[1],
5432
- actual = args[2],
5433
- expected = args.slice(3),
5434
- englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) {
5435
- return ' ' + s.toLowerCase();
5436
- });
5496
+ const args = Array.prototype.slice.call(arguments, 0);
5497
+ const matcherName = args[0];
5498
+ const isNot = args[1];
5499
+ const actual = args[2];
5500
+ const expected = args.slice(3);
5501
+ const englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) {
5502
+ return ' ' + s.toLowerCase();
5503
+ });
5437
5504
 
5438
5505
  let message =
5439
5506
  'Expected ' +
@@ -5815,8 +5882,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
5815
5882
  } else {
5816
5883
  // Objects with different constructors are not equivalent, but `Object`s
5817
5884
  // or `Array`s from different frames are.
5818
- const aCtor = a.constructor,
5819
- bCtor = b.constructor;
5885
+ const aCtor = a.constructor;
5886
+ const bCtor = b.constructor;
5820
5887
  if (
5821
5888
  aCtor !== bCtor &&
5822
5889
  isFunction(aCtor) &&
@@ -5922,11 +5989,11 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
5922
5989
  }
5923
5990
 
5924
5991
  function objectKeysAreDifferentFormatter(pp, actual, expected, path) {
5925
- const missingProperties = extraKeysAndValues(expected, actual),
5926
- extraProperties = extraKeysAndValues(actual, expected),
5927
- missingPropertiesMessage = formatKeyValuePairs(pp, missingProperties),
5928
- extraPropertiesMessage = formatKeyValuePairs(pp, extraProperties),
5929
- messages = [];
5992
+ const missingProperties = extraKeysAndValues(expected, actual);
5993
+ const extraProperties = extraKeysAndValues(actual, expected);
5994
+ const missingPropertiesMessage = formatKeyValuePairs(pp, missingProperties);
5995
+ const extraPropertiesMessage = formatKeyValuePairs(pp, extraProperties);
5996
+ const messages = [];
5930
5997
 
5931
5998
  if (!path.depth()) {
5932
5999
  path = 'object';
@@ -6184,14 +6251,15 @@ getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) {
6184
6251
  'use strict';
6185
6252
 
6186
6253
  const availableMatchers = [
6187
- 'toBePending',
6188
- 'toBeResolved',
6189
- 'toBeRejected',
6190
- 'toBeResolvedTo',
6191
- 'toBeRejectedWith',
6192
- 'toBeRejectedWithError'
6193
- ],
6194
- matchers = {};
6254
+ 'toBePending',
6255
+ 'toBeResolved',
6256
+ 'toBeRejected',
6257
+ 'toBeResolvedTo',
6258
+ 'toBeRejectedWith',
6259
+ 'toBeRejectedWithError',
6260
+ 'toBeRejectedWithMatching'
6261
+ ];
6262
+ const matchers = {};
6195
6263
 
6196
6264
  for (const name of availableMatchers) {
6197
6265
  matchers[name] = jRequire[name](j$);
@@ -6797,11 +6865,11 @@ getJasmineRequireObj().toEqual = function(j$) {
6797
6865
  return {
6798
6866
  compare: function(actual, expected) {
6799
6867
  const result = {
6800
- pass: false
6801
- },
6802
- diffBuilder = new j$.private.DiffBuilder({
6803
- prettyPrinter: matchersUtil.pp
6804
- });
6868
+ pass: false
6869
+ };
6870
+ const diffBuilder = new j$.private.DiffBuilder({
6871
+ prettyPrinter: matchersUtil.pp
6872
+ });
6805
6873
 
6806
6874
  result.pass = matchersUtil.equals(actual, expected, diffBuilder);
6807
6875
 
@@ -6986,9 +7054,9 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
6986
7054
  function toHaveBeenCalledOnceWith(matchersUtil) {
6987
7055
  return {
6988
7056
  compare: function() {
6989
- const args = Array.prototype.slice.call(arguments, 0),
6990
- actual = args[0],
6991
- expectedArgs = args.slice(1);
7057
+ const args = Array.prototype.slice.call(arguments, 0);
7058
+ const actual = args[0];
7059
+ const expectedArgs = args.slice(1);
6992
7060
 
6993
7061
  if (!j$.isSpy(actual)) {
6994
7062
  throw new Error(
@@ -7105,8 +7173,8 @@ getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
7105
7173
  );
7106
7174
  }
7107
7175
 
7108
- const args = Array.prototype.slice.call(arguments, 0),
7109
- result = { pass: false };
7176
+ const args = Array.prototype.slice.call(arguments, 0);
7177
+ const result = { pass: false };
7110
7178
 
7111
7179
  if (!j$.private.isNumber(expected)) {
7112
7180
  throw new Error(
@@ -7175,10 +7243,10 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
7175
7243
  function toHaveBeenCalledWith(matchersUtil) {
7176
7244
  return {
7177
7245
  compare: function() {
7178
- const args = Array.prototype.slice.call(arguments, 0),
7179
- actual = args[0],
7180
- expectedArgs = args.slice(1),
7181
- result = { pass: false };
7246
+ const args = Array.prototype.slice.call(arguments, 0);
7247
+ const actual = args[0];
7248
+ const expectedArgs = args.slice(1);
7249
+ const result = { pass: false };
7182
7250
 
7183
7251
  if (!j$.isSpy(actual)) {
7184
7252
  throw new Error(
@@ -10067,22 +10135,22 @@ getJasmineRequireObj().Spy = function(j$) {
10067
10135
  };
10068
10136
  const { originalFn, customStrategies, defaultStrategyFn } = optionals || {};
10069
10137
 
10070
- const numArgs = typeof originalFn === 'function' ? originalFn.length : 0,
10071
- wrapper = makeFunc(numArgs, function(context, args, invokeNew) {
10072
- return spy(context, args, invokeNew);
10073
- }),
10074
- strategyDispatcher = new SpyStrategyDispatcher(
10075
- {
10076
- name: name,
10077
- fn: originalFn,
10078
- getSpy: function() {
10079
- return wrapper;
10080
- },
10081
- customStrategies: customStrategies
10138
+ const numArgs = typeof originalFn === 'function' ? originalFn.length : 0;
10139
+ const wrapper = makeFunc(numArgs, function(context, args, invokeNew) {
10140
+ return spy(context, args, invokeNew);
10141
+ });
10142
+ const strategyDispatcher = new SpyStrategyDispatcher(
10143
+ {
10144
+ name: name,
10145
+ fn: originalFn,
10146
+ getSpy: function() {
10147
+ return wrapper;
10082
10148
  },
10083
- matchersUtil
10084
- ),
10085
- callTracker = new j$.private.CallTracker();
10149
+ customStrategies: customStrategies
10150
+ },
10151
+ matchersUtil
10152
+ );
10153
+ const callTracker = new j$.private.CallTracker();
10086
10154
 
10087
10155
  function makeFunc(length, fn) {
10088
10156
  switch (length) {
@@ -10529,10 +10597,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
10529
10597
  );
10530
10598
  }
10531
10599
 
10532
- let pointer = obj,
10533
- propsToSpyOn = [],
10534
- properties,
10535
- propertiesToSkip = [];
10600
+ let pointer = obj;
10601
+ let propsToSpyOn = [];
10602
+ let properties;
10603
+ let propertiesToSkip = [];
10536
10604
 
10537
10605
  while (
10538
10606
  pointer &&
@@ -11816,9 +11884,9 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
11816
11884
 
11817
11885
  function beforeAndAfterFns(targetSuite) {
11818
11886
  return function() {
11819
- let befores = [],
11820
- afters = [],
11821
- suite = targetSuite;
11887
+ let befores = [];
11888
+ let afters = [];
11889
+ let suite = targetSuite;
11822
11890
 
11823
11891
  while (suite) {
11824
11892
  befores = befores.concat(suite.beforeFns);
@@ -12029,15 +12097,15 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
12029
12097
 
12030
12098
  function segmentChildren(node, orderedChildren, stats, executableIndex) {
12031
12099
  let currentSegment = {
12032
- index: 0,
12033
- owner: node,
12034
- nodes: [],
12035
- min: startingMin(executableIndex),
12036
- max: startingMax(executableIndex)
12037
- },
12038
- result = [currentSegment],
12039
- lastMax = defaultMax,
12040
- orderedChildSegments = orderChildSegments(orderedChildren, stats);
12100
+ index: 0,
12101
+ owner: node,
12102
+ nodes: [],
12103
+ min: startingMin(executableIndex),
12104
+ max: startingMax(executableIndex)
12105
+ };
12106
+ let result = [currentSegment];
12107
+ let lastMax = defaultMax;
12108
+ let orderedChildSegments = orderChildSegments(orderedChildren, stats);
12041
12109
 
12042
12110
  function isSegmentBoundary(minIndex) {
12043
12111
  return (
@@ -12048,9 +12116,9 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
12048
12116
  }
12049
12117
 
12050
12118
  for (let i = 0; i < orderedChildSegments.length; i++) {
12051
- const childSegment = orderedChildSegments[i],
12052
- maxIndex = childSegment.max,
12053
- minIndex = childSegment.min;
12119
+ const childSegment = orderedChildSegments[i];
12120
+ const maxIndex = childSegment.max;
12121
+ const minIndex = childSegment.min;
12054
12122
 
12055
12123
  if (isSegmentBoundary(minIndex)) {
12056
12124
  currentSegment = {
@@ -12073,12 +12141,12 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
12073
12141
  }
12074
12142
 
12075
12143
  function orderChildSegments(children, stats) {
12076
- const specifiedOrder = [],
12077
- unspecifiedOrder = [];
12144
+ const specifiedOrder = [];
12145
+ const unspecifiedOrder = [];
12078
12146
 
12079
12147
  for (let i = 0; i < children.length; i++) {
12080
- const child = children[i],
12081
- segments = stats[child.id].segments;
12148
+ const child = children[i];
12149
+ const segments = stats[child.id].segments;
12082
12150
 
12083
12151
  for (let j = 0; j < segments.length; j++) {
12084
12152
  const seg = segments[j];
@@ -12422,5 +12490,5 @@ getJasmineRequireObj().UserContext = function(j$) {
12422
12490
  };
12423
12491
 
12424
12492
  getJasmineRequireObj().version = function() {
12425
- return '6.1.0';
12493
+ return '6.2.0';
12426
12494
  };
@@ -79,15 +79,15 @@ module.exports.noGlobals = function() {
79
79
  return jasmineInterface;
80
80
  };
81
81
 
82
- const path = require('path'),
83
- fs = require('fs');
84
-
85
- const rootPath = path.join(__dirname, 'jasmine-core'),
86
- bootFiles = ['boot0.js', 'boot1.js'],
87
- legacyBootFiles = ['boot.js'],
88
- cssFiles = [],
89
- jsFiles = [],
90
- jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles);
82
+ const path = require('path');
83
+ const fs = require('fs');
84
+
85
+ const rootPath = path.join(__dirname, 'jasmine-core');
86
+ const bootFiles = ['boot0.js', 'boot1.js'];
87
+ const legacyBootFiles = ['boot.js'];
88
+ const cssFiles = [];
89
+ const jsFiles = [];
90
+ const jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles);
91
91
 
92
92
  fs.readdirSync(rootPath).forEach(function(file) {
93
93
  if (fs.statSync(path.join(rootPath, file)).isFile()) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jasmine-core",
3
3
  "license": "MIT",
4
- "version": "6.1.0",
4
+ "version": "6.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/jasmine/jasmine.git"
@@ -52,8 +52,8 @@
52
52
  "sass": "^1.58.3"
53
53
  },
54
54
  "browserslist": [
55
- "Safari >= 16",
56
- "Firefox >= 102",
55
+ "Safari >= 26",
56
+ "Firefox >= 140",
57
57
  "last 2 Chrome versions",
58
58
  "last 2 Edge versions"
59
59
  ]