@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.
@@ -8731,6 +8731,8 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
8731
8731
  return val.tagName;
8732
8732
  if (typeof val.asymmetricMatch === "function")
8733
8733
  return `${val.toString()} ${format(val.sample)}`;
8734
+ if (typeof val.toJSON === "function")
8735
+ return val.toJSON();
8734
8736
  if (seen.has(val))
8735
8737
  return seen.get(val);
8736
8738
  if (Array.isArray(val)) {
@@ -9463,8 +9465,8 @@ var collectorContext = {
9463
9465
  currentSuite: null
9464
9466
  };
9465
9467
  function collectTask(task) {
9466
- var _a2;
9467
- (_a2 = collectorContext.currentSuite) == null ? void 0 : _a2.tasks.push(task);
9468
+ var _a;
9469
+ (_a = collectorContext.currentSuite) == null ? void 0 : _a.tasks.push(task);
9468
9470
  }
9469
9471
  async function runWithSuite(suite2, fn2) {
9470
9472
  const prev = collectorContext.currentSuite;
@@ -9478,17 +9480,17 @@ function withTimeout(fn2, timeout, isHook = false) {
9478
9480
  const { setTimeout, clearTimeout } = getSafeTimers();
9479
9481
  return (...args) => {
9480
9482
  return Promise.race([fn2(...args), new Promise((resolve3, reject) => {
9481
- var _a2;
9483
+ var _a;
9482
9484
  const timer = setTimeout(() => {
9483
9485
  clearTimeout(timer);
9484
9486
  reject(new Error(makeTimeoutMsg(isHook, timeout)));
9485
9487
  }, timeout);
9486
- (_a2 = timer.unref) == null ? void 0 : _a2.call(timer);
9488
+ (_a = timer.unref) == null ? void 0 : _a.call(timer);
9487
9489
  })]);
9488
9490
  };
9489
9491
  }
9490
9492
  function createTestContext(test3, runner2) {
9491
- var _a2;
9493
+ var _a;
9492
9494
  const context = function() {
9493
9495
  throw new Error("done() callback is deprecated, use promise instead");
9494
9496
  };
@@ -9505,7 +9507,7 @@ function createTestContext(test3, runner2) {
9505
9507
  test3.onFinished || (test3.onFinished = []);
9506
9508
  test3.onFinished.push(fn2);
9507
9509
  };
9508
- return ((_a2 = runner2.extendTaskContext) == null ? void 0 : _a2.call(runner2, context)) || context;
9510
+ return ((_a = runner2.extendTaskContext) == null ? void 0 : _a.call(runner2, context)) || context;
9509
9511
  }
9510
9512
  function makeTimeoutMsg(isHook, timeout) {
9511
9513
  return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
@@ -9866,9 +9868,14 @@ function createSuite() {
9866
9868
  optionsOrFn,
9867
9869
  fnOrOptions
9868
9870
  );
9871
+ const fnFirst = typeof optionsOrFn === "function";
9869
9872
  cases.forEach((i2, idx) => {
9870
9873
  const items = Array.isArray(i2) ? i2 : [i2];
9871
- arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9874
+ if (fnFirst) {
9875
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => handler(...items), options) : suite2(formatTitle(_name, items, idx), () => handler(i2), options);
9876
+ } else {
9877
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9878
+ }
9872
9879
  });
9873
9880
  this.setContext("each", void 0);
9874
9881
  };
@@ -9894,9 +9901,14 @@ function createTaskCollector(fn2, context) {
9894
9901
  optionsOrFn,
9895
9902
  fnOrOptions
9896
9903
  );
9904
+ const fnFirst = typeof optionsOrFn === "function";
9897
9905
  cases.forEach((i2, idx) => {
9898
9906
  const items = Array.isArray(i2) ? i2 : [i2];
9899
- arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9907
+ if (fnFirst) {
9908
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), () => handler(...items), options) : test22(formatTitle(_name, items, idx), () => handler(i2), options);
9909
+ } else {
9910
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9911
+ }
9900
9912
  });
9901
9913
  this.setContext("each", void 0);
9902
9914
  };
@@ -9938,8 +9950,8 @@ function formatTitle(template, items, idx) {
9938
9950
  /\$([$\w_.]+)/g,
9939
9951
  // https://github.com/chaijs/chai/pull/1490
9940
9952
  (_, key) => {
9941
- var _a2, _b;
9942
- 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 });
9953
+ var _a, _b;
9954
+ 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 });
9943
9955
  }
9944
9956
  );
9945
9957
  }
@@ -10008,13 +10020,13 @@ function createTestHook(name, handler) {
10008
10020
  };
10009
10021
  }
10010
10022
 
10011
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10023
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10012
10024
  init_cjs_shims();
10013
10025
 
10014
10026
  // ../../node_modules/@vitest/runner/dist/utils.js
10015
10027
  init_cjs_shims();
10016
10028
 
10017
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10029
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10018
10030
  init_cjs_shims();
10019
10031
 
10020
10032
  // ../../node_modules/vitest/dist/vendor/global.CkGT_TMy.js
@@ -10032,10 +10044,7 @@ function getCurrentEnvironment() {
10032
10044
  return state == null ? void 0 : state.environment.name;
10033
10045
  }
10034
10046
 
10035
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10036
- var _a;
10037
- var isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
10038
- var isWindows = isNode && process.platform === "win32";
10047
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10039
10048
  function getRunMode() {
10040
10049
  return getWorkerState().config.mode;
10041
10050
  }
@@ -10043,7 +10052,7 @@ function isRunningInBenchmark() {
10043
10052
  return getRunMode() === "benchmark";
10044
10053
  }
10045
10054
 
10046
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10055
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10047
10056
  var benchFns = /* @__PURE__ */ new WeakMap();
10048
10057
  var benchOptsMap = /* @__PURE__ */ new WeakMap();
10049
10058
  var bench = createBenchmark(
@@ -10096,7 +10105,7 @@ function isFirstRun() {
10096
10105
  return firstRun;
10097
10106
  }
10098
10107
 
10099
- // ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
10108
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
10100
10109
  init_cjs_shims();
10101
10110
 
10102
10111
  // ../../node_modules/chai/index.mjs
@@ -10683,6 +10692,10 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
10683
10692
  }
10684
10693
  if (!bIterator.next().done)
10685
10694
  return false;
10695
+ const aEntries = Object.entries(a);
10696
+ const bEntries = Object.entries(b2);
10697
+ if (!equals(aEntries, bEntries))
10698
+ return false;
10686
10699
  aStack.pop();
10687
10700
  bStack.pop();
10688
10701
  return true;
@@ -10702,7 +10715,7 @@ function subsetEquality(object2, subset, customTesters = []) {
10702
10715
  if (!isObjectWithKeys(subset2))
10703
10716
  return void 0;
10704
10717
  return Object.keys(subset2).every((key) => {
10705
- if (typeof subset2[key] === "object") {
10718
+ if (subset2[key] != null && typeof subset2[key] === "object") {
10706
10719
  if (seenReferences.has(subset2[key]))
10707
10720
  return equals(object22[key], subset2[key], filteredCustomTesters);
10708
10721
  seenReferences.set(subset2[key], true);
@@ -10771,8 +10784,8 @@ function getObjectKeys(object2) {
10771
10784
  ...Object.keys(object2),
10772
10785
  ...Object.getOwnPropertySymbols(object2).filter(
10773
10786
  (s) => {
10774
- var _a2;
10775
- return (_a2 = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a2.enumerable;
10787
+ var _a;
10788
+ return (_a = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a.enumerable;
10776
10789
  }
10777
10790
  )
10778
10791
  ];
@@ -11107,7 +11120,7 @@ function recordAsyncExpect(test3, promise) {
11107
11120
  }
11108
11121
  function wrapSoft(utils, fn2) {
11109
11122
  return function(...args) {
11110
- var _a2;
11123
+ var _a;
11111
11124
  const test3 = utils.flag(this, "vitest-test");
11112
11125
  const state = (test3 == null ? void 0 : test3.context._local) ? test3.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
11113
11126
  if (!state.soft)
@@ -11119,7 +11132,7 @@ function wrapSoft(utils, fn2) {
11119
11132
  } catch (err) {
11120
11133
  test3.result || (test3.result = { state: "fail" });
11121
11134
  test3.result.state = "fail";
11122
- (_a2 = test3.result).errors || (_a2.errors = []);
11135
+ (_a = test3.result).errors || (_a.errors = []);
11123
11136
  test3.result.errors.push(processError(err));
11124
11137
  }
11125
11138
  };
@@ -12239,9 +12252,9 @@ ${snapshots.join("\n\n")}
12239
12252
  }
12240
12253
  function prepareExpected(expected) {
12241
12254
  function findStartIndent() {
12242
- var _a2, _b;
12255
+ var _a, _b;
12243
12256
  const matchObject = /^( +)}\s+$/m.exec(expected || "");
12244
- const objectIndent = (_a2 = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a2.length;
12257
+ const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
12245
12258
  if (objectIndent)
12246
12259
  return objectIndent;
12247
12260
  const matchText = /^\n( +)"/.exec(expected || "");
@@ -12808,8 +12821,8 @@ function parseStacktrace(stack, options = {}) {
12808
12821
  if (ignoreStackEntries.length)
12809
12822
  stacks = stacks.filter((stack2) => !ignoreStackEntries.some((p) => stack2.file.match(p)));
12810
12823
  return stacks.map((stack2) => {
12811
- var _a2;
12812
- const map2 = (_a2 = options.getSourceMap) == null ? void 0 : _a2.call(options, stack2.file);
12824
+ var _a;
12825
+ const map2 = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
12813
12826
  if (!map2 || typeof map2 !== "object" || !map2.version)
12814
12827
  return stack2;
12815
12828
  const traceMap = new TraceMap(map2);
@@ -13221,10 +13234,10 @@ var SnapshotClient = class {
13221
13234
  snapshotState;
13222
13235
  snapshotStateMap = /* @__PURE__ */ new Map();
13223
13236
  async startCurrentRun(filepath, name, options) {
13224
- var _a2;
13237
+ var _a;
13225
13238
  this.filepath = filepath;
13226
13239
  this.name = name;
13227
- if (((_a2 = this.snapshotState) == null ? void 0 : _a2.testFilePath) !== filepath) {
13240
+ if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
13228
13241
  await this.finishCurrentRun();
13229
13242
  if (!this.getSnapshotState(filepath)) {
13230
13243
  this.snapshotStateMap.set(
@@ -13246,11 +13259,11 @@ var SnapshotClient = class {
13246
13259
  this.name = void 0;
13247
13260
  }
13248
13261
  skipTestSnapshots(name) {
13249
- var _a2;
13250
- (_a2 = this.snapshotState) == null ? void 0 : _a2.markSnapshotsAsCheckedForTest(name);
13262
+ var _a;
13263
+ (_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
13251
13264
  }
13252
13265
  assert(options) {
13253
- var _a2, _b, _c, _d;
13266
+ var _a, _b, _c, _d;
13254
13267
  const {
13255
13268
  filepath = this.filepath,
13256
13269
  name = this.name,
@@ -13269,7 +13282,7 @@ var SnapshotClient = class {
13269
13282
  if (typeof received !== "object" || !received)
13270
13283
  throw new Error("Received value must be an object when the matcher has properties");
13271
13284
  try {
13272
- const pass2 = ((_b = (_a2 = this.options).isEqual) == null ? void 0 : _b.call(_a2, received, properties)) ?? false;
13285
+ const pass2 = ((_b = (_a = this.options).isEqual) == null ? void 0 : _b.call(_a, received, properties)) ?? false;
13273
13286
  if (!pass2)
13274
13287
  throw createMismatchError("Snapshot properties mismatched", (_c = this.snapshotState) == null ? void 0 : _c.expand, received, properties);
13275
13288
  else
@@ -13330,7 +13343,7 @@ function getFullName(task, separator = " > ") {
13330
13343
  return getNames(task).join(separator);
13331
13344
  }
13332
13345
 
13333
- // ../../node_modules/vitest/dist/vendor/base.Xt0Omgh7.js
13346
+ // ../../node_modules/vitest/dist/vendor/base.5NT-gWu5.js
13334
13347
  init_cjs_shims();
13335
13348
  function isChildProcess() {
13336
13349
  return typeof process !== "undefined" && !!process.send;
@@ -13388,7 +13401,7 @@ function resetDate() {
13388
13401
  globalThis.Date = RealDate;
13389
13402
  }
13390
13403
 
13391
- // ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
13404
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
13392
13405
  function resetModules(modules, resetMocks = false) {
13393
13406
  const skipPaths = [
13394
13407
  // Vitest
@@ -13569,11 +13582,11 @@ function getError(expected, promise) {
13569
13582
  }
13570
13583
  var SnapshotPlugin = (chai3, utils) => {
13571
13584
  const getTestNames = (test3) => {
13572
- var _a2;
13585
+ var _a;
13573
13586
  if (!test3)
13574
13587
  return {};
13575
13588
  return {
13576
- filepath: (_a2 = test3.file) == null ? void 0 : _a2.filepath,
13589
+ filepath: (_a = test3.file) == null ? void 0 : _a.filepath,
13577
13590
  name: getNames(test3).slice(1).join(" > ")
13578
13591
  };
13579
13592
  };
@@ -13630,12 +13643,12 @@ var SnapshotPlugin = (chai3, utils) => {
13630
13643
  chai3.Assertion.prototype,
13631
13644
  "toMatchInlineSnapshot",
13632
13645
  function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
13633
- var _a2;
13646
+ var _a;
13634
13647
  const isNot = utils.flag(this, "negate");
13635
13648
  if (isNot)
13636
13649
  throw new Error('toMatchInlineSnapshot cannot be used with "not"');
13637
13650
  const test3 = utils.flag(this, "vitest-test");
13638
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13651
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13639
13652
  if (isInsideEach)
13640
13653
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13641
13654
  const expected = utils.flag(this, "object");
@@ -13683,12 +13696,12 @@ var SnapshotPlugin = (chai3, utils) => {
13683
13696
  chai3.Assertion.prototype,
13684
13697
  "toThrowErrorMatchingInlineSnapshot",
13685
13698
  function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
13686
- var _a2;
13699
+ var _a;
13687
13700
  const isNot = utils.flag(this, "negate");
13688
13701
  if (isNot)
13689
13702
  throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
13690
13703
  const test3 = utils.flag(this, "vitest-test");
13691
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13704
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13692
13705
  if (isInsideEach)
13693
13706
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13694
13707
  const expected = utils.flag(this, "object");
@@ -13720,7 +13733,7 @@ use(Subset);
13720
13733
  use(SnapshotPlugin);
13721
13734
  use(JestAsymmetricMatchers);
13722
13735
  function createExpect(test3) {
13723
- var _a2;
13736
+ var _a;
13724
13737
  const expect2 = (value, message) => {
13725
13738
  const { assertionCalls } = getState(expect2);
13726
13739
  setState({ assertionCalls: assertionCalls + 1, soft: false }, expect2);
@@ -13745,7 +13758,7 @@ function createExpect(test3) {
13745
13758
  expectedAssertionsNumber: null,
13746
13759
  expectedAssertionsNumberErrorGen: null,
13747
13760
  environment: getCurrentEnvironment(),
13748
- testPath: test3 ? (_a2 = test3.suite.file) == null ? void 0 : _a2.filepath : globalState.testPath,
13761
+ testPath: test3 ? (_a = test3.suite.file) == null ? void 0 : _a.filepath : globalState.testPath,
13749
13762
  currentTestName: test3 ? getFullName(test3) : globalState.currentTestName
13750
13763
  }, expect2);
13751
13764
  expect2.extend = (matchers) => expect.extend(expect2, matchers);
@@ -15320,7 +15333,7 @@ var FakeTimers = class {
15320
15333
  }
15321
15334
  }
15322
15335
  useFakeTimers() {
15323
- var _a2, _b, _c;
15336
+ var _a, _b, _c;
15324
15337
  if (this._fakingDate) {
15325
15338
  throw new Error(
15326
15339
  '"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.'
@@ -15328,7 +15341,7 @@ var FakeTimers = class {
15328
15341
  }
15329
15342
  if (!this._fakingTime) {
15330
15343
  const toFake = Object.keys(this._fakeTimers.timers).filter((timer) => timer !== "nextTick");
15331
- if (((_b = (_a2 = this._userConfig) == null ? void 0 : _a2.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15344
+ if (((_b = (_a = this._userConfig) == null ? void 0 : _a.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15332
15345
  throw new Error("process.nextTick cannot be mocked inside child_process");
15333
15346
  const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
15334
15347
  switch (method) {
@@ -15529,9 +15542,9 @@ function createVitest() {
15529
15542
  };
15530
15543
  const utils = {
15531
15544
  useFakeTimers(config2) {
15532
- var _a2, _b, _c, _d;
15545
+ var _a, _b, _c, _d;
15533
15546
  if (isChildProcess()) {
15534
- 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"))) {
15547
+ 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"))) {
15535
15548
  throw new Error(
15536
15549
  'vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.'
15537
15550
  );
@@ -15731,7 +15744,7 @@ function createVitest() {
15731
15744
  var vitest = createVitest();
15732
15745
  var vi = vitest;
15733
15746
 
15734
- // ../../node_modules/vitest/dist/vendor/index.0RrMQKD8.js
15747
+ // ../../node_modules/vitest/dist/vendor/index.dI9lHwVn.js
15735
15748
  init_cjs_shims();
15736
15749
  function getRunningMode() {
15737
15750
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";