jasmine-core 5.7.1 → 5.8.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
@@ -29,7 +29,7 @@ Microsoft Edge) as well as Node.
29
29
 
30
30
  | Environment | Supported versions |
31
31
  |-------------------|----------------------------|
32
- | Node | 18, 20, 22 |
32
+ | Node | 18, 20, 22, 24 |
33
33
  | Safari | 15*, 16*, 17* |
34
34
  | Chrome | Evergreen |
35
35
  | Firefox | Evergreen, 102*, 115*, 128 |
@@ -2803,7 +2803,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
2803
2803
 
2804
2804
  this.track = function(context) {
2805
2805
  if (opts.cloneArgs) {
2806
- context.args = j$.util.cloneArgs(context.args);
2806
+ context.args = opts.argsCloner(context.args);
2807
2807
  }
2808
2808
  calls.push(context);
2809
2809
  };
@@ -2911,13 +2911,15 @@ getJasmineRequireObj().CallTracker = function(j$) {
2911
2911
  };
2912
2912
 
2913
2913
  /**
2914
- * Set this spy to do a shallow clone of arguments passed to each invocation.
2914
+ * Set this spy to do a clone of arguments passed to each invocation.
2915
2915
  * @name Spy#calls#saveArgumentsByValue
2916
2916
  * @since 2.5.0
2917
+ * @param {Function} [argsCloner] A function to use to clone the arguments. Defaults to a shallow cloning function.
2917
2918
  * @function
2918
2919
  */
2919
- this.saveArgumentsByValue = function() {
2920
+ this.saveArgumentsByValue = function(argsCloner = j$.util.cloneArgs) {
2920
2921
  opts.cloneArgs = true;
2922
+ opts.argsCloner = argsCloner;
2921
2923
  };
2922
2924
 
2923
2925
  this.unverifiedCount = function() {
@@ -3282,6 +3284,12 @@ callbacks to execute _before_ running the next one.
3282
3284
  //
3283
3285
  // @return {!Promise<undefined>}
3284
3286
  async function newMacrotask() {
3287
+ if (NODE_JS) {
3288
+ // setImmediate is generally faster than setTimeout in Node
3289
+ // https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#setimmediate-vs-settimeout
3290
+ return new Promise(resolve => void setImmediate(resolve));
3291
+ }
3292
+
3285
3293
  // MessageChannel ensures that setTimeout is not throttled to 4ms.
3286
3294
  // https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#reasons_for_delays_longer_than_specified
3287
3295
  // https://stackblitz.com/edit/stackblitz-starters-qtlpcc
@@ -4875,7 +4883,10 @@ getJasmineRequireObj().DiffBuilder = function(j$) {
4875
4883
  );
4876
4884
 
4877
4885
  if (useCustom) {
4878
- messages.push(wrapPrettyPrinted(actualCustom, expectedCustom, path));
4886
+ const prettyActual = actualCustom || this.prettyPrinter_(actual);
4887
+ const prettyExpected =
4888
+ expectedCustom || this.prettyPrinter_(expected);
4889
+ messages.push(wrapPrettyPrinted(prettyActual, prettyExpected, path));
4879
4890
  return false; // don't recurse further
4880
4891
  }
4881
4892
 
@@ -7752,7 +7763,11 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
7752
7763
  } else if (value instanceof RegExp) {
7753
7764
  this.emitScalar(value.toString());
7754
7765
  } else if (typeof value === 'function') {
7755
- this.emitScalar('Function');
7766
+ if (value.name) {
7767
+ this.emitScalar(`Function '${value.name}'`);
7768
+ } else {
7769
+ this.emitScalar('Function');
7770
+ }
7756
7771
  } else if (j$.isDomNode(value)) {
7757
7772
  if (value.tagName) {
7758
7773
  this.emitDomElement(value);
@@ -9668,7 +9683,7 @@ getJasmineRequireObj().Spy = function(j$) {
9668
9683
  "Spy '" +
9669
9684
  strategyArgs.name +
9670
9685
  "' received a call with arguments " +
9671
- j$.basicPrettyPrinter_(Array.prototype.slice.call(args)) +
9686
+ matchersUtil.pp(Array.prototype.slice.call(args)) +
9672
9687
  ' but all configured strategies specify other arguments.'
9673
9688
  );
9674
9689
  } else {
@@ -11395,5 +11410,5 @@ getJasmineRequireObj().UserContext = function(j$) {
11395
11410
  };
11396
11411
 
11397
11412
  getJasmineRequireObj().version = function() {
11398
- return '5.7.1';
11413
+ return '5.8.0';
11399
11414
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jasmine-core",
3
3
  "license": "MIT",
4
- "version": "5.7.1",
4
+ "version": "5.8.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/jasmine/jasmine.git"