@noma.to/qwik-testing-library 1.2.0 → 1.3.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.
Files changed (96) hide show
  1. package/README.md +4 -3
  2. package/lib/lib/mock.qwik.cjs +3 -3
  3. package/lib/lib/mock.qwik.mjs +1 -1
  4. package/lib/lib/qwikloader.qwik.cjs +1 -1
  5. package/lib/lib/qwikloader.qwik.mjs +1 -1
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
  8. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@2.1.8}/node_modules/@vitest/expect/dist/index.qwik.cjs +155 -71
  9. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@2.1.8}/node_modules/@vitest/expect/dist/index.qwik.mjs +148 -64
  10. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@2.1.8}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +11 -5
  11. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@2.1.8}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +11 -5
  12. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +2 -2
  13. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +2 -2
  14. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/index.qwik.cjs +34 -28
  15. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/index.qwik.mjs +31 -25
  16. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@2.1.8}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +863 -460
  17. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@2.1.8}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +863 -460
  18. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs → @vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs} +6 -2
  19. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs → @vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs} +6 -2
  20. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/diff.qwik.cjs +458 -450
  21. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/diff.qwik.mjs +456 -448
  22. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/error.qwik.cjs +5 -5
  23. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/error.qwik.mjs +2 -2
  24. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +1 -1
  25. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +1 -1
  26. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.cjs +472 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.mjs +472 -0
  28. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +20 -20
  29. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +20 -20
  30. package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.cjs +71 -39
  31. package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.mjs +71 -39
  32. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/error.qwik.cjs +7 -1
  33. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/error.qwik.mjs +7 -1
  34. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/object.qwik.cjs +1 -1
  35. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/object.qwik.mjs +1 -1
  36. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/string.qwik.cjs +1 -2
  37. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/string.qwik.mjs +1 -2
  38. package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.cjs +44 -33
  39. package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.mjs +44 -33
  40. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
  41. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
  42. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.cjs +2749 -0
  43. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.mjs +2749 -0
  44. package/package.json +13 -13
  45. package/lib/_virtual/_commonjsHelpers.qwik.cjs +0 -4
  46. package/lib/_virtual/_commonjsHelpers.qwik.mjs +0 -4
  47. package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +0 -4
  48. package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +0 -4
  49. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +0 -425
  50. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +0 -425
  51. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -81
  52. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -81
  53. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +0 -6
  54. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +0 -6
  55. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +0 -16
  56. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +0 -16
  57. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +0 -2556
  58. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +0 -2556
  59. /package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@2.1.8}/node_modules/@vitest/spy/dist/index.qwik.cjs +0 -0
  60. /package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@2.1.8}/node_modules/@vitest/spy/dist/index.qwik.mjs +0 -0
  61. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
  62. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
  63. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/array.qwik.cjs +0 -0
  64. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/array.qwik.mjs +0 -0
  65. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
  66. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
  67. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/class.qwik.cjs +0 -0
  68. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/class.qwik.mjs +0 -0
  69. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/date.qwik.cjs +0 -0
  70. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/date.qwik.mjs +0 -0
  71. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/function.qwik.cjs +0 -0
  72. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/function.qwik.mjs +0 -0
  73. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
  74. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
  75. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/html.qwik.cjs +0 -0
  76. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/html.qwik.mjs +0 -0
  77. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/index.qwik.cjs +0 -0
  78. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/index.qwik.mjs +0 -0
  79. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/map.qwik.cjs +0 -0
  80. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/map.qwik.mjs +0 -0
  81. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/number.qwik.cjs +0 -0
  82. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/number.qwik.mjs +0 -0
  83. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
  84. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
  85. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
  86. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
  87. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/set.qwik.cjs +0 -0
  88. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/set.qwik.mjs +0 -0
  89. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
  90. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
  91. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
  92. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
  93. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
  94. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
  95. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
  96. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
@@ -3,51 +3,19 @@ var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const diff = require("../../../../../@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/diff.qwik.cjs");
6
7
  const browser = require("../../../../../tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs");
7
- const diff = require("../../../../../@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.cjs");
8
- const index = require("../../../../../@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.cjs");
9
- const error = require("../../../../../@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.cjs");
10
- const chai = require("../../../../../chai@5.1.1/node_modules/chai/chai.qwik.cjs");
11
- const helpers = require("../../../../../@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.cjs");
12
- const chunkDisplay = require("../../../../../@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs");
8
+ const index = require("../../../../../@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.cjs");
9
+ const error = require("../../../../../@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/error.qwik.cjs");
10
+ const chai = require("../../../../../chai@5.1.2/node_modules/chai/chai.qwik.cjs");
11
+ const helpers = require("../../../../../@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/helpers.qwik.cjs");
12
+ const chunk_commonjsHelpers = require("../../../../../@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs");
13
13
  const MATCHERS_OBJECT = Symbol.for("matchers-object");
14
14
  const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
15
15
  const GLOBAL_EXPECT = Symbol.for("expect-global");
16
16
  const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for(
17
17
  "asymmetric-matchers-object"
18
18
  );
19
- if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
20
- const globalState = /* @__PURE__ */ new WeakMap();
21
- const matchers = /* @__PURE__ */ Object.create(null);
22
- const customEqualityTesters = [];
23
- const assymetricMatchers = /* @__PURE__ */ Object.create(null);
24
- Object.defineProperty(globalThis, MATCHERS_OBJECT, {
25
- get: () => globalState
26
- });
27
- Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
28
- configurable: true,
29
- get: () => ({
30
- state: globalState.get(globalThis[GLOBAL_EXPECT]),
31
- matchers,
32
- customEqualityTesters
33
- })
34
- });
35
- Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
36
- get: () => assymetricMatchers
37
- });
38
- }
39
- function getState(expect) {
40
- return globalThis[MATCHERS_OBJECT].get(expect);
41
- }
42
- function setState(state, expect) {
43
- const map = globalThis[MATCHERS_OBJECT];
44
- const current = map.get(expect) || {};
45
- const results = Object.defineProperties(current, {
46
- ...Object.getOwnPropertyDescriptors(current),
47
- ...Object.getOwnPropertyDescriptors(state)
48
- });
49
- map.set(expect, results);
50
- }
51
19
  const EXPECTED_COLOR = browser.default.green;
52
20
  const RECEIVED_COLOR = browser.default.red;
53
21
  const INVERTED_COLOR = browser.default.inverse;
@@ -107,10 +75,10 @@ function replaceTrailingSpaces(text) {
107
75
  return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
108
76
  }
109
77
  function printReceived(object) {
110
- return RECEIVED_COLOR(replaceTrailingSpaces(chunkDisplay.s(object)));
78
+ return RECEIVED_COLOR(replaceTrailingSpaces(chunk_commonjsHelpers.s(object)));
111
79
  }
112
80
  function printExpected(value) {
113
- return EXPECTED_COLOR(replaceTrailingSpaces(chunkDisplay.s(value)));
81
+ return EXPECTED_COLOR(replaceTrailingSpaces(chunk_commonjsHelpers.s(value)));
114
82
  }
115
83
  function getMatcherUtils() {
116
84
  return {
@@ -211,6 +179,7 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
211
179
  const numB = +b;
212
180
  return numA === numB || Number.isNaN(numA) && Number.isNaN(numB);
213
181
  }
182
+ // RegExps are compared by their source patterns and flags.
214
183
  case "[object RegExp]":
215
184
  return a.source === b.source && a.flags === b.flags;
216
185
  }
@@ -512,7 +481,7 @@ function getObjectKeys(object) {
512
481
  )
513
482
  ];
514
483
  }
515
- function getObjectSubset(object, subset, customTesters = []) {
484
+ function getObjectSubset(object, subset, customTesters) {
516
485
  let stripped = 0;
517
486
  const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
518
487
  if (Array.isArray(object2)) {
@@ -533,6 +502,12 @@ function getObjectSubset(object, subset, customTesters = []) {
533
502
  }
534
503
  const trimmed = {};
535
504
  seenReferences.set(object2, trimmed);
505
+ if (typeof object2.constructor === "function" && typeof object2.constructor.name === "string") {
506
+ Object.defineProperty(trimmed, "constructor", {
507
+ enumerable: false,
508
+ value: object2.constructor
509
+ });
510
+ }
536
511
  for (const key of getObjectKeys(object2)) {
537
512
  if (hasPropertyInObject(subset2, key)) {
538
513
  trimmed[key] = seenReferences.has(object2[key]) ? seenReferences.get(object2[key]) : getObjectSubsetWithContext(seenReferences)(
@@ -560,6 +535,38 @@ function getObjectSubset(object, subset, customTesters = []) {
560
535
  };
561
536
  return { subset: getObjectSubsetWithContext()(object, subset), stripped };
562
537
  }
538
+ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
539
+ const globalState = /* @__PURE__ */ new WeakMap();
540
+ const matchers = /* @__PURE__ */ Object.create(null);
541
+ const customEqualityTesters = [];
542
+ const assymetricMatchers = /* @__PURE__ */ Object.create(null);
543
+ Object.defineProperty(globalThis, MATCHERS_OBJECT, {
544
+ get: () => globalState
545
+ });
546
+ Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
547
+ configurable: true,
548
+ get: () => ({
549
+ state: globalState.get(globalThis[GLOBAL_EXPECT]),
550
+ matchers,
551
+ customEqualityTesters
552
+ })
553
+ });
554
+ Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
555
+ get: () => assymetricMatchers
556
+ });
557
+ }
558
+ function getState(expect) {
559
+ return globalThis[MATCHERS_OBJECT].get(expect);
560
+ }
561
+ function setState(state, expect) {
562
+ const map = globalThis[MATCHERS_OBJECT];
563
+ const current = map.get(expect) || {};
564
+ const results = Object.defineProperties(current, {
565
+ ...Object.getOwnPropertyDescriptors(current),
566
+ ...Object.getOwnPropertyDescriptors(state)
567
+ });
568
+ map.set(expect, results);
569
+ }
563
570
  class AsymmetricMatcher {
564
571
  constructor(sample, inverse = false) {
565
572
  // should have "jest" to be compatible with its ecosystem
@@ -576,7 +583,7 @@ class AsymmetricMatcher {
576
583
  utils: {
577
584
  ...getMatcherUtils(),
578
585
  diff: diff.diff,
579
- stringify: chunkDisplay.s,
586
+ stringify: chunk_commonjsHelpers.s,
580
587
  iterableEquality,
581
588
  subsetEquality
582
589
  }
@@ -585,7 +592,7 @@ class AsymmetricMatcher {
585
592
  // implement custom chai/loupe inspect for better AssertionError.message formatting
586
593
  // https://github.com/chaijs/loupe/blob/9b8a6deabcd50adc056a64fb705896194710c5c6/src/index.ts#L29
587
594
  [Symbol.for("chai/inspect")](options) {
588
- const result = chunkDisplay.s(this, options.depth, { min: true });
595
+ const result = chunk_commonjsHelpers.s(this, options.depth, { min: true });
589
596
  if (result.length <= options.truncate) {
590
597
  return result;
591
598
  }
@@ -856,9 +863,20 @@ const JestAsymmetricMatchers = (chai2, utils) => {
856
863
  closeTo: (expected, precision) => new CloseTo(expected, precision, true)
857
864
  };
858
865
  };
859
- function recordAsyncExpect(test, promise) {
866
+ function createAssertionMessage(util, assertion, hasArgs) {
867
+ const not = util.flag(assertion, "negate") ? "not." : "";
868
+ const name = `${util.flag(assertion, "_name")}(${hasArgs ? "expected" : ""})`;
869
+ const promiseName = util.flag(assertion, "promise");
870
+ const promise = promiseName ? `.${promiseName}` : "";
871
+ return `expect(actual)${promise}.${not}${name}`;
872
+ }
873
+ function recordAsyncExpect(_test, promise, assertion, error2) {
874
+ const test = _test;
860
875
  if (test && promise instanceof Promise) {
861
876
  promise = promise.finally(() => {
877
+ if (!test.promises) {
878
+ return;
879
+ }
862
880
  const index2 = test.promises.indexOf(promise);
863
881
  if (index2 !== -1) {
864
882
  test.promises.splice(index2, 1);
@@ -868,12 +886,43 @@ function recordAsyncExpect(test, promise) {
868
886
  test.promises = [];
869
887
  }
870
888
  test.promises.push(promise);
889
+ let resolved = false;
890
+ test.onFinished ?? (test.onFinished = []);
891
+ test.onFinished.push(() => {
892
+ var _a;
893
+ if (!resolved) {
894
+ const processor = ((_a = globalThis.__vitest_worker__) == null ? void 0 : _a.onFilterStackTrace) || ((s) => s || "");
895
+ const stack = processor(error2.stack);
896
+ console.warn([
897
+ `Promise returned by \`${assertion}\` was not awaited. `,
898
+ "Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
899
+ "Please remember to await the assertion.\n",
900
+ stack
901
+ ].join(""));
902
+ }
903
+ });
904
+ return {
905
+ then(onFullfilled, onRejected) {
906
+ resolved = true;
907
+ return promise.then(onFullfilled, onRejected);
908
+ },
909
+ catch(onRejected) {
910
+ return promise.catch(onRejected);
911
+ },
912
+ finally(onFinally) {
913
+ return promise.finally(onFinally);
914
+ },
915
+ [Symbol.toStringTag]: "Promise"
916
+ };
871
917
  }
872
918
  return promise;
873
919
  }
874
- function wrapSoft(utils, fn) {
920
+ function wrapAssertion(utils, name, fn) {
875
921
  return function(...args) {
876
922
  var _a;
923
+ if (name !== "withTest") {
924
+ utils.flag(this, "_name", name);
925
+ }
877
926
  if (!utils.flag(this, "soft")) {
878
927
  return fn.apply(this, args);
879
928
  }
@@ -896,7 +945,7 @@ const JestChaiExpect = (chai2, utils) => {
896
945
  const customTesters = getCustomEqualityTesters();
897
946
  function def(name, fn) {
898
947
  const addMethod = (n) => {
899
- const softWrapper = wrapSoft(utils, fn);
948
+ const softWrapper = wrapAssertion(utils, n, fn);
900
949
  utils.addMethod(chai2.Assertion.prototype, n, softWrapper);
901
950
  utils.addMethod(
902
951
  globalThis[JEST_MATCHERS_OBJECT].matchers,
@@ -1022,7 +1071,8 @@ const JestChaiExpect = (chai2, utils) => {
1022
1071
  const isNot = utils.flag(this, "negate");
1023
1072
  const { subset: actualSubset, stripped } = getObjectSubset(
1024
1073
  actual,
1025
- expected
1074
+ expected,
1075
+ customTesters
1026
1076
  );
1027
1077
  if (pass && isNot || !pass && !isNot) {
1028
1078
  const msg = utils.getMessage(this, [
@@ -1117,8 +1167,8 @@ const JestChaiExpect = (chai2, utils) => {
1117
1167
  Boolean(obj),
1118
1168
  "expected #{this} to be truthy",
1119
1169
  "expected #{this} to not be truthy",
1120
- obj,
1121
- false
1170
+ true,
1171
+ obj
1122
1172
  );
1123
1173
  });
1124
1174
  def("toBeFalsy", function() {
@@ -1127,8 +1177,8 @@ const JestChaiExpect = (chai2, utils) => {
1127
1177
  !obj,
1128
1178
  "expected #{this} to be falsy",
1129
1179
  "expected #{this} to not be falsy",
1130
- obj,
1131
- false
1180
+ false,
1181
+ obj
1132
1182
  );
1133
1183
  });
1134
1184
  def("toBeGreaterThan", function(expected) {
@@ -1139,8 +1189,8 @@ const JestChaiExpect = (chai2, utils) => {
1139
1189
  actual > expected,
1140
1190
  `expected ${actual} to be greater than ${expected}`,
1141
1191
  `expected ${actual} to be not greater than ${expected}`,
1142
- actual,
1143
1192
  expected,
1193
+ actual,
1144
1194
  false
1145
1195
  );
1146
1196
  });
@@ -1152,8 +1202,8 @@ const JestChaiExpect = (chai2, utils) => {
1152
1202
  actual >= expected,
1153
1203
  `expected ${actual} to be greater than or equal to ${expected}`,
1154
1204
  `expected ${actual} to be not greater than or equal to ${expected}`,
1155
- actual,
1156
1205
  expected,
1206
+ actual,
1157
1207
  false
1158
1208
  );
1159
1209
  });
@@ -1165,8 +1215,8 @@ const JestChaiExpect = (chai2, utils) => {
1165
1215
  actual < expected,
1166
1216
  `expected ${actual} to be less than ${expected}`,
1167
1217
  `expected ${actual} to be not less than ${expected}`,
1168
- actual,
1169
1218
  expected,
1219
+ actual,
1170
1220
  false
1171
1221
  );
1172
1222
  });
@@ -1178,27 +1228,49 @@ const JestChaiExpect = (chai2, utils) => {
1178
1228
  actual <= expected,
1179
1229
  `expected ${actual} to be less than or equal to ${expected}`,
1180
1230
  `expected ${actual} to be not less than or equal to ${expected}`,
1181
- actual,
1182
1231
  expected,
1232
+ actual,
1183
1233
  false
1184
1234
  );
1185
1235
  });
1186
1236
  def("toBeNaN", function() {
1187
- return this.be.NaN;
1237
+ const obj = utils.flag(this, "object");
1238
+ this.assert(
1239
+ Number.isNaN(obj),
1240
+ "expected #{this} to be NaN",
1241
+ "expected #{this} not to be NaN",
1242
+ Number.NaN,
1243
+ obj
1244
+ );
1188
1245
  });
1189
1246
  def("toBeUndefined", function() {
1190
- return this.be.undefined;
1247
+ const obj = utils.flag(this, "object");
1248
+ this.assert(
1249
+ void 0 === obj,
1250
+ "expected #{this} to be undefined",
1251
+ "expected #{this} not to be undefined",
1252
+ void 0,
1253
+ obj
1254
+ );
1191
1255
  });
1192
1256
  def("toBeNull", function() {
1193
- return this.be.null;
1257
+ const obj = utils.flag(this, "object");
1258
+ this.assert(
1259
+ obj === null,
1260
+ "expected #{this} to be null",
1261
+ "expected #{this} not to be null",
1262
+ null,
1263
+ obj
1264
+ );
1194
1265
  });
1195
1266
  def("toBeDefined", function() {
1196
- const negate = utils.flag(this, "negate");
1197
- utils.flag(this, "negate", false);
1198
- if (negate) {
1199
- return this.be.undefined;
1200
- }
1201
- return this.not.be.undefined;
1267
+ const obj = utils.flag(this, "object");
1268
+ this.assert(
1269
+ typeof obj !== "undefined",
1270
+ "expected #{this} to be defined",
1271
+ "expected #{this} to be undefined",
1272
+ obj
1273
+ );
1202
1274
  });
1203
1275
  def(
1204
1276
  "toBeTypeOf",
@@ -1388,7 +1460,7 @@ const JestChaiExpect = (chai2, utils) => {
1388
1460
  ["toThrow", "toThrowError"],
1389
1461
  function(expected) {
1390
1462
  if (typeof expected === "string" || typeof expected === "undefined" || expected instanceof RegExp) {
1391
- return this.throws(expected);
1463
+ return this.throws(expected === "" ? /^$/ : expected);
1392
1464
  }
1393
1465
  const obj = this._obj;
1394
1466
  const promise = utils.flag(this, "promise");
@@ -1647,6 +1719,7 @@ const JestChaiExpect = (chai2, utils) => {
1647
1719
  return result instanceof chai2.Assertion ? proxy : result;
1648
1720
  }
1649
1721
  return (...args) => {
1722
+ utils.flag(this, "_name", key);
1650
1723
  const promise = obj.then(
1651
1724
  (value) => {
1652
1725
  utils.flag(this, "object", value);
@@ -1667,7 +1740,12 @@ const JestChaiExpect = (chai2, utils) => {
1667
1740
  throw _error;
1668
1741
  }
1669
1742
  );
1670
- return recordAsyncExpect(test, promise);
1743
+ return recordAsyncExpect(
1744
+ test,
1745
+ promise,
1746
+ createAssertionMessage(utils, this, !!args.length),
1747
+ error2
1748
+ );
1671
1749
  };
1672
1750
  }
1673
1751
  });
@@ -1701,6 +1779,7 @@ const JestChaiExpect = (chai2, utils) => {
1701
1779
  return result instanceof chai2.Assertion ? proxy : result;
1702
1780
  }
1703
1781
  return (...args) => {
1782
+ utils.flag(this, "_name", key);
1704
1783
  const promise = wrapper.then(
1705
1784
  (value) => {
1706
1785
  const _error = new AssertionError(
@@ -1724,7 +1803,12 @@ const JestChaiExpect = (chai2, utils) => {
1724
1803
  return result.call(this, ...args);
1725
1804
  }
1726
1805
  );
1727
- return recordAsyncExpect(test, promise);
1806
+ return recordAsyncExpect(
1807
+ test,
1808
+ promise,
1809
+ createAssertionMessage(utils, this, !!args.length),
1810
+ error2
1811
+ );
1728
1812
  };
1729
1813
  }
1730
1814
  });
@@ -1764,7 +1848,7 @@ ${spy.mock.calls.map((callArg, i) => {
1764
1848
  omitAnnotationLines: true
1765
1849
  });
1766
1850
  } else {
1767
- methodCall += chunkDisplay.s(callArg).split("\n").map((line) => ` ${line}`).join("\n");
1851
+ methodCall += chunk_commonjsHelpers.s(callArg).split("\n").map((line) => ` ${line}`).join("\n");
1768
1852
  }
1769
1853
  methodCall += "\n";
1770
1854
  return methodCall;
@@ -1796,7 +1880,7 @@ ${results.map((callReturn, i) => {
1796
1880
  omitAnnotationLines: true
1797
1881
  });
1798
1882
  } else {
1799
- methodCall += chunkDisplay.s(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
1883
+ methodCall += chunk_commonjsHelpers.s(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
1800
1884
  }
1801
1885
  methodCall += "\n";
1802
1886
  return methodCall;
@@ -1817,7 +1901,7 @@ function getMatcherState(assertion, expect) {
1817
1901
  const jestUtils = {
1818
1902
  ...getMatcherUtils(),
1819
1903
  diff: diff.diff,
1820
- stringify: chunkDisplay.s,
1904
+ stringify: chunk_commonjsHelpers.s,
1821
1905
  iterableEquality,
1822
1906
  subsetEquality
1823
1907
  };
@@ -1865,7 +1949,7 @@ function JestExtendPlugin(c, expect, matchers) {
1865
1949
  throw new JestExtendError(message(), actual, expected);
1866
1950
  }
1867
1951
  }
1868
- const softWrapper = wrapSoft(utils, expectWrapper);
1952
+ const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper);
1869
1953
  utils.addMethod(
1870
1954
  globalThis[JEST_MATCHERS_OBJECT].matchers,
1871
1955
  expectAssertionName,