@noma.to/qwik-testing-library 1.3.0 → 1.3.1
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/lib/lib/mock.qwik.cjs +3 -3
- package/lib/lib/mock.qwik.mjs +1 -1
- package/lib/lib/qwik-testing-library.qwik.cjs +2 -2
- package/lib/lib/qwik-testing-library.qwik.mjs +3 -3
- package/lib/lib/qwikloader.qwik.cjs +1 -1
- package/lib/lib/qwikloader.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.8 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.cjs +175 -35
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.8 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.mjs +180 -40
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.8 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +301 -10
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.8 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +306 -15
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.cjs +130 -44
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.mjs +130 -44
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.8 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +119 -84
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.8 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +119 -84
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.8 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.cjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.8 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.mjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +3 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +3 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.cjs +37 -21
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.mjs +37 -21
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.cjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.mjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/index.qwik.cjs +6 -4
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/index.qwik.mjs +6 -4
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.mjs +6 -6
- package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.cjs +1 -3
- package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.mjs +1 -3
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.cjs} +2 -2
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.mjs} +2 -2
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
- package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +1 -1
- 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 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.cjs} +439 -211
- 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 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.mjs} +415 -187
- package/package.json +8 -8
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
package/lib/lib/mock.qwik.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
|
-
const
|
|
4
|
+
const vi_CjhMlMwf = require("../node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.cjs");
|
|
5
5
|
const mockQrl = () => {
|
|
6
|
-
return qwik.$(
|
|
6
|
+
return qwik.$(vi_CjhMlMwf.v.fn());
|
|
7
7
|
};
|
|
8
8
|
const mock$ = qwik.implicit$FirstArg(mockQrl);
|
|
9
9
|
function clearAllMocks() {
|
|
10
|
-
|
|
10
|
+
vi_CjhMlMwf.v.clearAllMocks();
|
|
11
11
|
}
|
|
12
12
|
exports.clearAllMocks = clearAllMocks;
|
|
13
13
|
exports.mock$ = mock$;
|
package/lib/lib/mock.qwik.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { implicit$FirstArg, $ } from "@builder.io/qwik";
|
|
2
|
-
import { v as vi } from "../node_modules/.pnpm/vitest@
|
|
2
|
+
import { v as vi } from "../node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.mjs";
|
|
3
3
|
const mockQrl = () => {
|
|
4
4
|
return $(vi.fn());
|
|
5
5
|
};
|
|
@@ -24,8 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
25
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
26
26
|
const dom = require("@testing-library/dom");
|
|
27
|
-
const qwikloader = require("./qwikloader.qwik.cjs");
|
|
28
27
|
const mock = require("./mock.qwik.cjs");
|
|
28
|
+
const qwikloader = require("./qwikloader.qwik.cjs");
|
|
29
29
|
if (typeof process === "undefined" || !process.env?.QTL_SKIP_AUTO_CLEANUP) {
|
|
30
30
|
if (typeof afterEach === "function") {
|
|
31
31
|
afterEach(() => {
|
|
@@ -47,6 +47,7 @@ async function render(ui, options = {}) {
|
|
|
47
47
|
const wrappedUi = !Wrapper ? ui : /* @__PURE__ */ jsxRuntime.jsx(Wrapper, {
|
|
48
48
|
children: ui
|
|
49
49
|
});
|
|
50
|
+
qwikloader.qwikLoader(baseElement.ownerDocument);
|
|
50
51
|
const { cleanup: cleanup2 } = await qwik.render(container, wrappedUi, {
|
|
51
52
|
serverData
|
|
52
53
|
});
|
|
@@ -54,7 +55,6 @@ async function render(ui, options = {}) {
|
|
|
54
55
|
container,
|
|
55
56
|
componentCleanup: cleanup2
|
|
56
57
|
});
|
|
57
|
-
qwikloader.qwikLoader(baseElement.ownerDocument);
|
|
58
58
|
return {
|
|
59
59
|
container,
|
|
60
60
|
baseElement,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getQueriesForElement, prettyDOM } from "@testing-library/dom";
|
|
3
3
|
export * from "@testing-library/dom";
|
|
4
|
-
import { qwikLoader } from "./qwikloader.qwik.mjs";
|
|
5
4
|
import { clearAllMocks, mock$, mockQrl } from "./mock.qwik.mjs";
|
|
5
|
+
import { qwikLoader } from "./qwikloader.qwik.mjs";
|
|
6
6
|
if (typeof process === "undefined" || !process.env?.QTL_SKIP_AUTO_CLEANUP) {
|
|
7
7
|
if (typeof afterEach === "function") {
|
|
8
8
|
afterEach(() => {
|
|
@@ -24,6 +24,7 @@ async function render(ui, options = {}) {
|
|
|
24
24
|
const wrappedUi = !Wrapper ? ui : /* @__PURE__ */ jsx(Wrapper, {
|
|
25
25
|
children: ui
|
|
26
26
|
});
|
|
27
|
+
qwikLoader(baseElement.ownerDocument);
|
|
27
28
|
const { cleanup: cleanup2 } = await qwik.render(container, wrappedUi, {
|
|
28
29
|
serverData
|
|
29
30
|
});
|
|
@@ -31,7 +32,6 @@ async function render(ui, options = {}) {
|
|
|
31
32
|
container,
|
|
32
33
|
componentCleanup: cleanup2
|
|
33
34
|
});
|
|
34
|
-
qwikLoader(baseElement.ownerDocument);
|
|
35
35
|
return {
|
|
36
36
|
container,
|
|
37
37
|
baseElement,
|
|
@@ -11,7 +11,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
|
11
11
|
value
|
|
12
12
|
}) : obj[key] = value;
|
|
13
13
|
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b) {
|
|
14
|
+
for (var prop in b || (b = {})) {
|
|
15
15
|
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
16
16
|
}
|
|
17
17
|
if (__getOwnPropSymbols) {
|
|
@@ -9,7 +9,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
|
9
9
|
value
|
|
10
10
|
}) : obj[key] = value;
|
|
11
11
|
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b) {
|
|
12
|
+
for (var prop in b || (b = {})) {
|
|
13
13
|
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
14
14
|
}
|
|
15
15
|
if (__getOwnPropSymbols) {
|
|
@@ -3,24 +3,72 @@ 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@
|
|
7
|
-
const browser = require("../../../../../tinyrainbow@
|
|
8
|
-
const index = require("../../../../../@vitest_spy@
|
|
9
|
-
const error = require("../../../../../@vitest_utils@
|
|
6
|
+
const diff = require("../../../../../@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/diff.qwik.cjs");
|
|
7
|
+
const browser = require("../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs");
|
|
8
|
+
const index = require("../../../../../@vitest_spy@3.0.5/node_modules/@vitest/spy/dist/index.qwik.cjs");
|
|
9
|
+
const error = require("../../../../../@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/error.qwik.cjs");
|
|
10
10
|
const chai = require("../../../../../chai@5.1.2/node_modules/chai/chai.qwik.cjs");
|
|
11
|
-
const helpers = require("../../../../../@vitest_utils@
|
|
12
|
-
const chunk_commonjsHelpers = require("../../../../../@vitest_utils@
|
|
11
|
+
const helpers = require("../../../../../@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/helpers.qwik.cjs");
|
|
12
|
+
const chunk_commonjsHelpers = require("../../../../../@vitest_utils@3.0.5/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
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
19
|
+
const customMatchers = {
|
|
20
|
+
toSatisfy(actual, expected, message) {
|
|
21
|
+
const { printReceived: printReceived2, printExpected: printExpected2, matcherHint: matcherHint2 } = this.utils;
|
|
22
|
+
const pass = expected(actual);
|
|
23
|
+
return {
|
|
24
|
+
pass,
|
|
25
|
+
message: () => pass ? `${matcherHint2(".not.toSatisfy", "received", "")}
|
|
26
|
+
|
|
27
|
+
Expected value to not satisfy:
|
|
28
|
+
${message || printExpected2(expected)}
|
|
29
|
+
Received:
|
|
30
|
+
${printReceived2(actual)}` : `${matcherHint2(".toSatisfy", "received", "")}
|
|
31
|
+
|
|
32
|
+
Expected value to satisfy:
|
|
33
|
+
${message || printExpected2(expected)}
|
|
34
|
+
|
|
35
|
+
Received:
|
|
36
|
+
${printReceived2(actual)}`
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
toBeOneOf(actual, expected) {
|
|
40
|
+
const { equals: equals2, customTesters } = this;
|
|
41
|
+
const { printReceived: printReceived2, printExpected: printExpected2, matcherHint: matcherHint2 } = this.utils;
|
|
42
|
+
if (!Array.isArray(expected)) {
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
`You must provide an array to ${matcherHint2(".toBeOneOf")}, not '${typeof expected}'.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const pass = expected.length === 0 || expected.some(
|
|
48
|
+
(item) => equals2(item, actual, customTesters)
|
|
49
|
+
);
|
|
50
|
+
return {
|
|
51
|
+
pass,
|
|
52
|
+
message: () => pass ? `${matcherHint2(".not.toBeOneOf", "received", "")}
|
|
53
|
+
|
|
54
|
+
Expected value to not be one of:
|
|
55
|
+
${printExpected2(expected)}
|
|
56
|
+
Received:
|
|
57
|
+
${printReceived2(actual)}` : `${matcherHint2(".toBeOneOf", "received", "")}
|
|
58
|
+
|
|
59
|
+
Expected value to be one of:
|
|
60
|
+
${printExpected2(expected)}
|
|
61
|
+
|
|
62
|
+
Received:
|
|
63
|
+
${printReceived2(actual)}`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const EXPECTED_COLOR = browser.green;
|
|
68
|
+
const RECEIVED_COLOR = browser.red;
|
|
69
|
+
const INVERTED_COLOR = browser.inverse;
|
|
70
|
+
const BOLD_WEIGHT = browser.bold;
|
|
71
|
+
const DIM_COLOR = browser.dim;
|
|
24
72
|
function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
|
|
25
73
|
const {
|
|
26
74
|
comment = "",
|
|
@@ -147,9 +195,6 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
147
195
|
return customTesterResult;
|
|
148
196
|
}
|
|
149
197
|
}
|
|
150
|
-
if (a instanceof Error && b instanceof Error) {
|
|
151
|
-
return a.message === b.message;
|
|
152
|
-
}
|
|
153
198
|
if (typeof URL === "function" && a instanceof URL && b instanceof URL) {
|
|
154
199
|
return a.href === b.href;
|
|
155
200
|
}
|
|
@@ -202,6 +247,14 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
202
247
|
if (className === "[object Array]" && a.length !== b.length) {
|
|
203
248
|
return false;
|
|
204
249
|
}
|
|
250
|
+
if (a instanceof Error && b instanceof Error) {
|
|
251
|
+
try {
|
|
252
|
+
return isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2);
|
|
253
|
+
} finally {
|
|
254
|
+
aStack.pop();
|
|
255
|
+
bStack.pop();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
205
258
|
const aKeys = keys(a, hasKey2);
|
|
206
259
|
let key;
|
|
207
260
|
let size = aKeys.length;
|
|
@@ -219,6 +272,17 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
219
272
|
bStack.pop();
|
|
220
273
|
return result;
|
|
221
274
|
}
|
|
275
|
+
function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
276
|
+
let result = Object.getPrototypeOf(a) === Object.getPrototypeOf(b) && a.name === b.name && a.message === b.message;
|
|
277
|
+
if (typeof b.cause !== "undefined") {
|
|
278
|
+
result && (result = eq(a.cause, b.cause, aStack, bStack, customTesters, hasKey2));
|
|
279
|
+
}
|
|
280
|
+
if (a instanceof AggregateError && b instanceof AggregateError) {
|
|
281
|
+
result && (result = eq(a.errors, b.errors, aStack, bStack, customTesters, hasKey2));
|
|
282
|
+
}
|
|
283
|
+
result && (result = eq({ ...a }, { ...b }, aStack, bStack, customTesters, hasKey2));
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
222
286
|
function keys(obj, hasKey2) {
|
|
223
287
|
const keys2 = [];
|
|
224
288
|
for (const key in obj) {
|
|
@@ -539,7 +603,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
|
539
603
|
const globalState = /* @__PURE__ */ new WeakMap();
|
|
540
604
|
const matchers = /* @__PURE__ */ Object.create(null);
|
|
541
605
|
const customEqualityTesters = [];
|
|
542
|
-
const
|
|
606
|
+
const asymmetricMatchers = /* @__PURE__ */ Object.create(null);
|
|
543
607
|
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
544
608
|
get: () => globalState
|
|
545
609
|
});
|
|
@@ -552,7 +616,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
|
552
616
|
})
|
|
553
617
|
});
|
|
554
618
|
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
555
|
-
get: () =>
|
|
619
|
+
get: () => asymmetricMatchers
|
|
556
620
|
});
|
|
557
621
|
}
|
|
558
622
|
function getState(expect) {
|
|
@@ -902,9 +966,9 @@ function recordAsyncExpect(_test, promise, assertion, error2) {
|
|
|
902
966
|
}
|
|
903
967
|
});
|
|
904
968
|
return {
|
|
905
|
-
then(
|
|
969
|
+
then(onFulfilled, onRejected) {
|
|
906
970
|
resolved = true;
|
|
907
|
-
return promise.then(
|
|
971
|
+
return promise.then(onFulfilled, onRejected);
|
|
908
972
|
},
|
|
909
973
|
catch(onRejected) {
|
|
910
974
|
return promise.catch(onRejected);
|
|
@@ -1419,6 +1483,25 @@ const JestChaiExpect = (chai2, utils) => {
|
|
|
1419
1483
|
throw new AssertionError(formatCalls(spy, msg, args));
|
|
1420
1484
|
}
|
|
1421
1485
|
});
|
|
1486
|
+
def("toHaveBeenCalledExactlyOnceWith", function(...args) {
|
|
1487
|
+
const spy = getSpy(this);
|
|
1488
|
+
const spyName = spy.getMockName();
|
|
1489
|
+
const callCount = spy.mock.calls.length;
|
|
1490
|
+
const hasCallWithArgs = spy.mock.calls.some(
|
|
1491
|
+
(callArg) => equals(callArg, args, [...customTesters, iterableEquality])
|
|
1492
|
+
);
|
|
1493
|
+
const pass = hasCallWithArgs && callCount === 1;
|
|
1494
|
+
const isNot = utils.flag(this, "negate");
|
|
1495
|
+
const msg = utils.getMessage(this, [
|
|
1496
|
+
pass,
|
|
1497
|
+
`expected "${spyName}" to be called once with arguments: #{exp}`,
|
|
1498
|
+
`expected "${spyName}" to not be called once with arguments: #{exp}`,
|
|
1499
|
+
args
|
|
1500
|
+
]);
|
|
1501
|
+
if (pass && isNot || !pass && !isNot) {
|
|
1502
|
+
throw new AssertionError(formatCalls(spy, msg, args));
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1422
1505
|
def(
|
|
1423
1506
|
["toHaveBeenNthCalledWith", "nthCalledWith"],
|
|
1424
1507
|
function(times, ...args) {
|
|
@@ -1456,6 +1539,61 @@ const JestChaiExpect = (chai2, utils) => {
|
|
|
1456
1539
|
);
|
|
1457
1540
|
}
|
|
1458
1541
|
);
|
|
1542
|
+
function isSpyCalledBeforeAnotherSpy(beforeSpy, afterSpy, failIfNoFirstInvocation) {
|
|
1543
|
+
const beforeInvocationCallOrder = beforeSpy.mock.invocationCallOrder;
|
|
1544
|
+
const afterInvocationCallOrder = afterSpy.mock.invocationCallOrder;
|
|
1545
|
+
if (beforeInvocationCallOrder.length === 0) {
|
|
1546
|
+
return !failIfNoFirstInvocation;
|
|
1547
|
+
}
|
|
1548
|
+
if (afterInvocationCallOrder.length === 0) {
|
|
1549
|
+
return false;
|
|
1550
|
+
}
|
|
1551
|
+
return beforeInvocationCallOrder[0] < afterInvocationCallOrder[0];
|
|
1552
|
+
}
|
|
1553
|
+
def(
|
|
1554
|
+
["toHaveBeenCalledBefore"],
|
|
1555
|
+
function(resultSpy, failIfNoFirstInvocation = true) {
|
|
1556
|
+
const expectSpy = getSpy(this);
|
|
1557
|
+
if (!index.isMockFunction(resultSpy)) {
|
|
1558
|
+
throw new TypeError(
|
|
1559
|
+
`${utils.inspect(resultSpy)} is not a spy or a call to a spy`
|
|
1560
|
+
);
|
|
1561
|
+
}
|
|
1562
|
+
this.assert(
|
|
1563
|
+
isSpyCalledBeforeAnotherSpy(
|
|
1564
|
+
expectSpy,
|
|
1565
|
+
resultSpy,
|
|
1566
|
+
failIfNoFirstInvocation
|
|
1567
|
+
),
|
|
1568
|
+
`expected "${expectSpy.getMockName()}" to have been called before "${resultSpy.getMockName()}"`,
|
|
1569
|
+
`expected "${expectSpy.getMockName()}" to not have been called before "${resultSpy.getMockName()}"`,
|
|
1570
|
+
resultSpy,
|
|
1571
|
+
expectSpy
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
def(
|
|
1576
|
+
["toHaveBeenCalledAfter"],
|
|
1577
|
+
function(resultSpy, failIfNoFirstInvocation = true) {
|
|
1578
|
+
const expectSpy = getSpy(this);
|
|
1579
|
+
if (!index.isMockFunction(resultSpy)) {
|
|
1580
|
+
throw new TypeError(
|
|
1581
|
+
`${utils.inspect(resultSpy)} is not a spy or a call to a spy`
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
this.assert(
|
|
1585
|
+
isSpyCalledBeforeAnotherSpy(
|
|
1586
|
+
resultSpy,
|
|
1587
|
+
expectSpy,
|
|
1588
|
+
failIfNoFirstInvocation
|
|
1589
|
+
),
|
|
1590
|
+
`expected "${expectSpy.getMockName()}" to have been called after "${resultSpy.getMockName()}"`,
|
|
1591
|
+
`expected "${expectSpy.getMockName()}" to not have been called after "${resultSpy.getMockName()}"`,
|
|
1592
|
+
resultSpy,
|
|
1593
|
+
expectSpy
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1596
|
+
);
|
|
1459
1597
|
def(
|
|
1460
1598
|
["toThrow", "toThrowError"],
|
|
1461
1599
|
function(expected) {
|
|
@@ -1505,12 +1643,16 @@ const JestChaiExpect = (chai2, utils) => {
|
|
|
1505
1643
|
);
|
|
1506
1644
|
}
|
|
1507
1645
|
if (expected instanceof Error) {
|
|
1646
|
+
const equal = equals(thrown, expected, [
|
|
1647
|
+
...customTesters,
|
|
1648
|
+
iterableEquality
|
|
1649
|
+
]);
|
|
1508
1650
|
return this.assert(
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
expected
|
|
1513
|
-
thrown
|
|
1651
|
+
equal,
|
|
1652
|
+
"expected a thrown error to be #{exp}",
|
|
1653
|
+
"expected a thrown error not to be #{exp}",
|
|
1654
|
+
expected,
|
|
1655
|
+
thrown
|
|
1514
1656
|
);
|
|
1515
1657
|
}
|
|
1516
1658
|
if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") {
|
|
@@ -1684,9 +1826,6 @@ const JestChaiExpect = (chai2, utils) => {
|
|
|
1684
1826
|
);
|
|
1685
1827
|
});
|
|
1686
1828
|
});
|
|
1687
|
-
def("toSatisfy", function(matcher, message) {
|
|
1688
|
-
return this.be.satisfy(matcher, message);
|
|
1689
|
-
});
|
|
1690
1829
|
def("withContext", function(context) {
|
|
1691
1830
|
for (const key in context) {
|
|
1692
1831
|
utils.flag(this, key, context[key]);
|
|
@@ -1832,13 +1971,13 @@ function ordinalOf(i) {
|
|
|
1832
1971
|
}
|
|
1833
1972
|
function formatCalls(spy, msg, showActualCall) {
|
|
1834
1973
|
if (spy.mock.calls) {
|
|
1835
|
-
msg += browser.
|
|
1974
|
+
msg += browser.gray(
|
|
1836
1975
|
`
|
|
1837
1976
|
|
|
1838
1977
|
Received:
|
|
1839
1978
|
|
|
1840
1979
|
${spy.mock.calls.map((callArg, i) => {
|
|
1841
|
-
let methodCall = browser.
|
|
1980
|
+
let methodCall = browser.bold(
|
|
1842
1981
|
` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
|
|
1843
1982
|
|
|
1844
1983
|
`
|
|
@@ -1855,22 +1994,22 @@ ${spy.mock.calls.map((callArg, i) => {
|
|
|
1855
1994
|
}).join("\n")}`
|
|
1856
1995
|
);
|
|
1857
1996
|
}
|
|
1858
|
-
msg += browser.
|
|
1997
|
+
msg += browser.gray(
|
|
1859
1998
|
`
|
|
1860
1999
|
|
|
1861
|
-
Number of calls: ${browser.
|
|
2000
|
+
Number of calls: ${browser.bold(spy.mock.calls.length)}
|
|
1862
2001
|
`
|
|
1863
2002
|
);
|
|
1864
2003
|
return msg;
|
|
1865
2004
|
}
|
|
1866
2005
|
function formatReturns(spy, results, msg, showActualReturn) {
|
|
1867
|
-
msg += browser.
|
|
2006
|
+
msg += browser.gray(
|
|
1868
2007
|
`
|
|
1869
2008
|
|
|
1870
2009
|
Received:
|
|
1871
2010
|
|
|
1872
2011
|
${results.map((callReturn, i) => {
|
|
1873
|
-
let methodCall = browser.
|
|
2012
|
+
let methodCall = browser.bold(
|
|
1874
2013
|
` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
|
|
1875
2014
|
|
|
1876
2015
|
`
|
|
@@ -1886,10 +2025,10 @@ ${results.map((callReturn, i) => {
|
|
|
1886
2025
|
return methodCall;
|
|
1887
2026
|
}).join("\n")}`
|
|
1888
2027
|
);
|
|
1889
|
-
msg += browser.
|
|
2028
|
+
msg += browser.gray(
|
|
1890
2029
|
`
|
|
1891
2030
|
|
|
1892
|
-
Number of calls: ${browser.
|
|
2031
|
+
Number of calls: ${browser.bold(spy.mock.calls.length)}
|
|
1893
2032
|
`
|
|
1894
2033
|
);
|
|
1895
2034
|
return msg;
|
|
@@ -1979,7 +2118,7 @@ function JestExtendPlugin(c, expect, matchers) {
|
|
|
1979
2118
|
return "any";
|
|
1980
2119
|
}
|
|
1981
2120
|
toAsymmetricMatcher() {
|
|
1982
|
-
return `${this.toString()}<${this.sample.map(
|
|
2121
|
+
return `${this.toString()}<${this.sample.map((item) => chunk_commonjsHelpers.s(item)).join(", ")}>`;
|
|
1983
2122
|
}
|
|
1984
2123
|
}
|
|
1985
2124
|
const customMatcher = (...sample) => new CustomMatcher(false, ...sample);
|
|
@@ -2034,6 +2173,7 @@ exports.StringContaining = StringContaining;
|
|
|
2034
2173
|
exports.StringMatching = StringMatching;
|
|
2035
2174
|
exports.addCustomEqualityTesters = addCustomEqualityTesters;
|
|
2036
2175
|
exports.arrayBufferEquality = arrayBufferEquality;
|
|
2176
|
+
exports.customMatchers = customMatchers;
|
|
2037
2177
|
exports.equals = equals;
|
|
2038
2178
|
exports.generateToBeMessage = generateToBeMessage;
|
|
2039
2179
|
exports.getObjectKeys = getObjectKeys;
|