@procore/hammer-test-jest 0.4.0 → 0.5.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.
@@ -8811,6 +8811,8 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
8811
8811
  return val.tagName;
8812
8812
  if (typeof val.asymmetricMatch === "function")
8813
8813
  return `${val.toString()} ${format(val.sample)}`;
8814
+ if (typeof val.toJSON === "function")
8815
+ return val.toJSON();
8814
8816
  if (seen.has(val))
8815
8817
  return seen.get(val);
8816
8818
  if (Array.isArray(val)) {
@@ -9543,8 +9545,8 @@ var collectorContext = {
9543
9545
  currentSuite: null
9544
9546
  };
9545
9547
  function collectTask(task) {
9546
- var _a2;
9547
- (_a2 = collectorContext.currentSuite) == null ? void 0 : _a2.tasks.push(task);
9548
+ var _a;
9549
+ (_a = collectorContext.currentSuite) == null ? void 0 : _a.tasks.push(task);
9548
9550
  }
9549
9551
  async function runWithSuite(suite2, fn2) {
9550
9552
  const prev = collectorContext.currentSuite;
@@ -9558,17 +9560,17 @@ function withTimeout(fn2, timeout, isHook = false) {
9558
9560
  const { setTimeout, clearTimeout } = getSafeTimers();
9559
9561
  return (...args) => {
9560
9562
  return Promise.race([fn2(...args), new Promise((resolve3, reject) => {
9561
- var _a2;
9563
+ var _a;
9562
9564
  const timer = setTimeout(() => {
9563
9565
  clearTimeout(timer);
9564
9566
  reject(new Error(makeTimeoutMsg(isHook, timeout)));
9565
9567
  }, timeout);
9566
- (_a2 = timer.unref) == null ? void 0 : _a2.call(timer);
9568
+ (_a = timer.unref) == null ? void 0 : _a.call(timer);
9567
9569
  })]);
9568
9570
  };
9569
9571
  }
9570
9572
  function createTestContext(test3, runner2) {
9571
- var _a2;
9573
+ var _a;
9572
9574
  const context = function() {
9573
9575
  throw new Error("done() callback is deprecated, use promise instead");
9574
9576
  };
@@ -9585,7 +9587,7 @@ function createTestContext(test3, runner2) {
9585
9587
  test3.onFinished || (test3.onFinished = []);
9586
9588
  test3.onFinished.push(fn2);
9587
9589
  };
9588
- return ((_a2 = runner2.extendTaskContext) == null ? void 0 : _a2.call(runner2, context)) || context;
9590
+ return ((_a = runner2.extendTaskContext) == null ? void 0 : _a.call(runner2, context)) || context;
9589
9591
  }
9590
9592
  function makeTimeoutMsg(isHook, timeout) {
9591
9593
  return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
@@ -9946,9 +9948,14 @@ function createSuite() {
9946
9948
  optionsOrFn,
9947
9949
  fnOrOptions
9948
9950
  );
9951
+ const fnFirst = typeof optionsOrFn === "function";
9949
9952
  cases.forEach((i2, idx) => {
9950
9953
  const items = Array.isArray(i2) ? i2 : [i2];
9951
- arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9954
+ if (fnFirst) {
9955
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => handler(...items), options) : suite2(formatTitle(_name, items, idx), () => handler(i2), options);
9956
+ } else {
9957
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9958
+ }
9952
9959
  });
9953
9960
  this.setContext("each", void 0);
9954
9961
  };
@@ -9974,9 +9981,14 @@ function createTaskCollector(fn2, context) {
9974
9981
  optionsOrFn,
9975
9982
  fnOrOptions
9976
9983
  );
9984
+ const fnFirst = typeof optionsOrFn === "function";
9977
9985
  cases.forEach((i2, idx) => {
9978
9986
  const items = Array.isArray(i2) ? i2 : [i2];
9979
- arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9987
+ if (fnFirst) {
9988
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), () => handler(...items), options) : test22(formatTitle(_name, items, idx), () => handler(i2), options);
9989
+ } else {
9990
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9991
+ }
9980
9992
  });
9981
9993
  this.setContext("each", void 0);
9982
9994
  };
@@ -10018,8 +10030,8 @@ function formatTitle(template, items, idx) {
10018
10030
  /\$([$\w_.]+)/g,
10019
10031
  // https://github.com/chaijs/chai/pull/1490
10020
10032
  (_, key) => {
10021
- var _a2, _b;
10022
- return objDisplay(objectAttr(items[0], key), { truncate: (_b = (_a2 = runner == null ? void 0 : runner.config) == null ? void 0 : _a2.chaiConfig) == null ? void 0 : _b.truncateThreshold });
10033
+ var _a, _b;
10034
+ return objDisplay(objectAttr(items[0], key), { truncate: (_b = (_a = runner == null ? void 0 : runner.config) == null ? void 0 : _a.chaiConfig) == null ? void 0 : _b.truncateThreshold });
10023
10035
  }
10024
10036
  );
10025
10037
  }
@@ -10088,13 +10100,13 @@ function createTestHook(name, handler) {
10088
10100
  };
10089
10101
  }
10090
10102
 
10091
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10103
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10092
10104
  init_cjs_shims();
10093
10105
 
10094
10106
  // ../../node_modules/@vitest/runner/dist/utils.js
10095
10107
  init_cjs_shims();
10096
10108
 
10097
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10109
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10098
10110
  init_cjs_shims();
10099
10111
 
10100
10112
  // ../../node_modules/vitest/dist/vendor/global.CkGT_TMy.js
@@ -10112,10 +10124,7 @@ function getCurrentEnvironment() {
10112
10124
  return state == null ? void 0 : state.environment.name;
10113
10125
  }
10114
10126
 
10115
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10116
- var _a;
10117
- var isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
10118
- var isWindows = isNode && process.platform === "win32";
10127
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10119
10128
  function getRunMode() {
10120
10129
  return getWorkerState().config.mode;
10121
10130
  }
@@ -10123,7 +10132,7 @@ function isRunningInBenchmark() {
10123
10132
  return getRunMode() === "benchmark";
10124
10133
  }
10125
10134
 
10126
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10135
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10127
10136
  var benchFns = /* @__PURE__ */ new WeakMap();
10128
10137
  var benchOptsMap = /* @__PURE__ */ new WeakMap();
10129
10138
  var bench = createBenchmark(
@@ -10176,7 +10185,7 @@ function isFirstRun() {
10176
10185
  return firstRun;
10177
10186
  }
10178
10187
 
10179
- // ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
10188
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
10180
10189
  init_cjs_shims();
10181
10190
 
10182
10191
  // ../../node_modules/chai/index.mjs
@@ -10763,6 +10772,10 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
10763
10772
  }
10764
10773
  if (!bIterator.next().done)
10765
10774
  return false;
10775
+ const aEntries = Object.entries(a);
10776
+ const bEntries = Object.entries(b2);
10777
+ if (!equals(aEntries, bEntries))
10778
+ return false;
10766
10779
  aStack.pop();
10767
10780
  bStack.pop();
10768
10781
  return true;
@@ -10782,7 +10795,7 @@ function subsetEquality(object2, subset, customTesters = []) {
10782
10795
  if (!isObjectWithKeys(subset2))
10783
10796
  return void 0;
10784
10797
  return Object.keys(subset2).every((key) => {
10785
- if (typeof subset2[key] === "object") {
10798
+ if (subset2[key] != null && typeof subset2[key] === "object") {
10786
10799
  if (seenReferences.has(subset2[key]))
10787
10800
  return equals(object22[key], subset2[key], filteredCustomTesters);
10788
10801
  seenReferences.set(subset2[key], true);
@@ -10851,8 +10864,8 @@ function getObjectKeys(object2) {
10851
10864
  ...Object.keys(object2),
10852
10865
  ...Object.getOwnPropertySymbols(object2).filter(
10853
10866
  (s) => {
10854
- var _a2;
10855
- return (_a2 = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a2.enumerable;
10867
+ var _a;
10868
+ return (_a = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a.enumerable;
10856
10869
  }
10857
10870
  )
10858
10871
  ];
@@ -11187,7 +11200,7 @@ function recordAsyncExpect(test3, promise) {
11187
11200
  }
11188
11201
  function wrapSoft(utils, fn2) {
11189
11202
  return function(...args) {
11190
- var _a2;
11203
+ var _a;
11191
11204
  const test3 = utils.flag(this, "vitest-test");
11192
11205
  const state = (test3 == null ? void 0 : test3.context._local) ? test3.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
11193
11206
  if (!state.soft)
@@ -11199,7 +11212,7 @@ function wrapSoft(utils, fn2) {
11199
11212
  } catch (err) {
11200
11213
  test3.result || (test3.result = { state: "fail" });
11201
11214
  test3.result.state = "fail";
11202
- (_a2 = test3.result).errors || (_a2.errors = []);
11215
+ (_a = test3.result).errors || (_a.errors = []);
11203
11216
  test3.result.errors.push(processError(err));
11204
11217
  }
11205
11218
  };
@@ -12319,9 +12332,9 @@ ${snapshots.join("\n\n")}
12319
12332
  }
12320
12333
  function prepareExpected(expected) {
12321
12334
  function findStartIndent() {
12322
- var _a2, _b;
12335
+ var _a, _b;
12323
12336
  const matchObject = /^( +)}\s+$/m.exec(expected || "");
12324
- const objectIndent = (_a2 = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a2.length;
12337
+ const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
12325
12338
  if (objectIndent)
12326
12339
  return objectIndent;
12327
12340
  const matchText = /^\n( +)"/.exec(expected || "");
@@ -12888,8 +12901,8 @@ function parseStacktrace(stack, options = {}) {
12888
12901
  if (ignoreStackEntries.length)
12889
12902
  stacks = stacks.filter((stack2) => !ignoreStackEntries.some((p) => stack2.file.match(p)));
12890
12903
  return stacks.map((stack2) => {
12891
- var _a2;
12892
- const map2 = (_a2 = options.getSourceMap) == null ? void 0 : _a2.call(options, stack2.file);
12904
+ var _a;
12905
+ const map2 = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
12893
12906
  if (!map2 || typeof map2 !== "object" || !map2.version)
12894
12907
  return stack2;
12895
12908
  const traceMap = new TraceMap(map2);
@@ -13301,10 +13314,10 @@ var SnapshotClient = class {
13301
13314
  snapshotState;
13302
13315
  snapshotStateMap = /* @__PURE__ */ new Map();
13303
13316
  async startCurrentRun(filepath, name, options) {
13304
- var _a2;
13317
+ var _a;
13305
13318
  this.filepath = filepath;
13306
13319
  this.name = name;
13307
- if (((_a2 = this.snapshotState) == null ? void 0 : _a2.testFilePath) !== filepath) {
13320
+ if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
13308
13321
  await this.finishCurrentRun();
13309
13322
  if (!this.getSnapshotState(filepath)) {
13310
13323
  this.snapshotStateMap.set(
@@ -13326,11 +13339,11 @@ var SnapshotClient = class {
13326
13339
  this.name = void 0;
13327
13340
  }
13328
13341
  skipTestSnapshots(name) {
13329
- var _a2;
13330
- (_a2 = this.snapshotState) == null ? void 0 : _a2.markSnapshotsAsCheckedForTest(name);
13342
+ var _a;
13343
+ (_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
13331
13344
  }
13332
13345
  assert(options) {
13333
- var _a2, _b, _c, _d;
13346
+ var _a, _b, _c, _d;
13334
13347
  const {
13335
13348
  filepath = this.filepath,
13336
13349
  name = this.name,
@@ -13349,7 +13362,7 @@ var SnapshotClient = class {
13349
13362
  if (typeof received !== "object" || !received)
13350
13363
  throw new Error("Received value must be an object when the matcher has properties");
13351
13364
  try {
13352
- const pass2 = ((_b = (_a2 = this.options).isEqual) == null ? void 0 : _b.call(_a2, received, properties)) ?? false;
13365
+ const pass2 = ((_b = (_a = this.options).isEqual) == null ? void 0 : _b.call(_a, received, properties)) ?? false;
13353
13366
  if (!pass2)
13354
13367
  throw createMismatchError("Snapshot properties mismatched", (_c = this.snapshotState) == null ? void 0 : _c.expand, received, properties);
13355
13368
  else
@@ -13410,7 +13423,7 @@ function getFullName(task, separator = " > ") {
13410
13423
  return getNames(task).join(separator);
13411
13424
  }
13412
13425
 
13413
- // ../../node_modules/vitest/dist/vendor/base.Xt0Omgh7.js
13426
+ // ../../node_modules/vitest/dist/vendor/base.5NT-gWu5.js
13414
13427
  init_cjs_shims();
13415
13428
  function isChildProcess() {
13416
13429
  return typeof process !== "undefined" && !!process.send;
@@ -13468,7 +13481,7 @@ function resetDate() {
13468
13481
  globalThis.Date = RealDate;
13469
13482
  }
13470
13483
 
13471
- // ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
13484
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
13472
13485
  function resetModules(modules, resetMocks = false) {
13473
13486
  const skipPaths = [
13474
13487
  // Vitest
@@ -13649,11 +13662,11 @@ function getError(expected, promise) {
13649
13662
  }
13650
13663
  var SnapshotPlugin = (chai3, utils) => {
13651
13664
  const getTestNames = (test3) => {
13652
- var _a2;
13665
+ var _a;
13653
13666
  if (!test3)
13654
13667
  return {};
13655
13668
  return {
13656
- filepath: (_a2 = test3.file) == null ? void 0 : _a2.filepath,
13669
+ filepath: (_a = test3.file) == null ? void 0 : _a.filepath,
13657
13670
  name: getNames(test3).slice(1).join(" > ")
13658
13671
  };
13659
13672
  };
@@ -13710,12 +13723,12 @@ var SnapshotPlugin = (chai3, utils) => {
13710
13723
  chai3.Assertion.prototype,
13711
13724
  "toMatchInlineSnapshot",
13712
13725
  function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
13713
- var _a2;
13726
+ var _a;
13714
13727
  const isNot = utils.flag(this, "negate");
13715
13728
  if (isNot)
13716
13729
  throw new Error('toMatchInlineSnapshot cannot be used with "not"');
13717
13730
  const test3 = utils.flag(this, "vitest-test");
13718
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13731
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13719
13732
  if (isInsideEach)
13720
13733
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13721
13734
  const expected = utils.flag(this, "object");
@@ -13763,12 +13776,12 @@ var SnapshotPlugin = (chai3, utils) => {
13763
13776
  chai3.Assertion.prototype,
13764
13777
  "toThrowErrorMatchingInlineSnapshot",
13765
13778
  function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
13766
- var _a2;
13779
+ var _a;
13767
13780
  const isNot = utils.flag(this, "negate");
13768
13781
  if (isNot)
13769
13782
  throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
13770
13783
  const test3 = utils.flag(this, "vitest-test");
13771
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13784
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13772
13785
  if (isInsideEach)
13773
13786
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13774
13787
  const expected = utils.flag(this, "object");
@@ -13800,7 +13813,7 @@ use(Subset);
13800
13813
  use(SnapshotPlugin);
13801
13814
  use(JestAsymmetricMatchers);
13802
13815
  function createExpect(test3) {
13803
- var _a2;
13816
+ var _a;
13804
13817
  const expect2 = (value, message) => {
13805
13818
  const { assertionCalls } = getState(expect2);
13806
13819
  setState({ assertionCalls: assertionCalls + 1, soft: false }, expect2);
@@ -13825,7 +13838,7 @@ function createExpect(test3) {
13825
13838
  expectedAssertionsNumber: null,
13826
13839
  expectedAssertionsNumberErrorGen: null,
13827
13840
  environment: getCurrentEnvironment(),
13828
- testPath: test3 ? (_a2 = test3.suite.file) == null ? void 0 : _a2.filepath : globalState.testPath,
13841
+ testPath: test3 ? (_a = test3.suite.file) == null ? void 0 : _a.filepath : globalState.testPath,
13829
13842
  currentTestName: test3 ? getFullName(test3) : globalState.currentTestName
13830
13843
  }, expect2);
13831
13844
  expect2.extend = (matchers) => expect.extend(expect2, matchers);
@@ -15400,7 +15413,7 @@ var FakeTimers = class {
15400
15413
  }
15401
15414
  }
15402
15415
  useFakeTimers() {
15403
- var _a2, _b, _c;
15416
+ var _a, _b, _c;
15404
15417
  if (this._fakingDate) {
15405
15418
  throw new Error(
15406
15419
  '"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.'
@@ -15408,7 +15421,7 @@ var FakeTimers = class {
15408
15421
  }
15409
15422
  if (!this._fakingTime) {
15410
15423
  const toFake = Object.keys(this._fakeTimers.timers).filter((timer) => timer !== "nextTick");
15411
- if (((_b = (_a2 = this._userConfig) == null ? void 0 : _a2.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15424
+ if (((_b = (_a = this._userConfig) == null ? void 0 : _a.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15412
15425
  throw new Error("process.nextTick cannot be mocked inside child_process");
15413
15426
  const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
15414
15427
  switch (method) {
@@ -15609,9 +15622,9 @@ function createVitest() {
15609
15622
  };
15610
15623
  const utils = {
15611
15624
  useFakeTimers(config2) {
15612
- var _a2, _b, _c, _d;
15625
+ var _a, _b, _c, _d;
15613
15626
  if (isChildProcess()) {
15614
- if (((_a2 = config2 == null ? void 0 : config2.toFake) == null ? void 0 : _a2.includes("nextTick")) || ((_d = (_c = (_b = workerState.config) == null ? void 0 : _b.fakeTimers) == null ? void 0 : _c.toFake) == null ? void 0 : _d.includes("nextTick"))) {
15627
+ if (((_a = config2 == null ? void 0 : config2.toFake) == null ? void 0 : _a.includes("nextTick")) || ((_d = (_c = (_b = workerState.config) == null ? void 0 : _b.fakeTimers) == null ? void 0 : _c.toFake) == null ? void 0 : _d.includes("nextTick"))) {
15615
15628
  throw new Error(
15616
15629
  'vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.'
15617
15630
  );
@@ -15811,7 +15824,7 @@ function createVitest() {
15811
15824
  var vitest = createVitest();
15812
15825
  var vi = vitest;
15813
15826
 
15814
- // ../../node_modules/vitest/dist/vendor/index.0RrMQKD8.js
15827
+ // ../../node_modules/vitest/dist/vendor/index.dI9lHwVn.js
15815
15828
  init_cjs_shims();
15816
15829
  function getRunningMode() {
15817
15830
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";