@noma.to/qwik-mock 1.0.2 → 1.1.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.
Files changed (53) hide show
  1. package/lib/lib/qwik-mock.cjs +24 -6
  2. package/lib/lib/qwik-mock.mjs +24 -6
  3. package/lib-types/index.d.ts +2 -1
  4. package/lib-types/lib/qwik-mock.d.ts +21 -19
  5. package/package.json +7 -6
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -83
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -83
  8. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.cjs +0 -1785
  9. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.mjs +0 -1785
  10. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.cjs +0 -964
  11. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.mjs +0 -964
  12. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.cjs +0 -60
  13. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.mjs +0 -60
  14. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.cjs +0 -1102
  15. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.mjs +0 -1102
  16. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.cjs +0 -1289
  17. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.mjs +0 -1289
  18. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.cjs +0 -422
  19. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.mjs +0 -422
  20. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +0 -6
  21. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +0 -6
  22. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -98
  23. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -98
  24. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.cjs +0 -1626
  25. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.mjs +0 -1626
  26. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.cjs +0 -690
  27. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.mjs +0 -690
  28. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.cjs +0 -39
  29. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.mjs +0 -39
  30. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.cjs +0 -151
  31. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.mjs +0 -151
  32. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.cjs +0 -114
  33. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.mjs +0 -114
  34. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.cjs +0 -125
  35. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.mjs +0 -125
  36. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.cjs +0 -22
  37. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.mjs +0 -22
  38. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -4056
  39. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -4056
  40. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -994
  41. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -994
  42. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -101
  43. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -101
  44. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.cjs +0 -84
  45. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.mjs +0 -84
  46. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -4
  47. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -4
  48. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.cjs +0 -51
  49. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.mjs +0 -51
  50. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.cjs +0 -45
  51. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.mjs +0 -45
  52. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.cjs +0 -2609
  53. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.mjs +0 -2609
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
4
- function normalizeWindowsPath(input = "") {
5
- if (!input) {
6
- return input;
7
- }
8
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
9
- }
10
- const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
11
- function cwd() {
12
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
13
- return process.cwd().replace(/\\/g, "/");
14
- }
15
- return "/";
16
- }
17
- const resolve = function(...arguments_) {
18
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
19
- let resolvedPath = "";
20
- let resolvedAbsolute = false;
21
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
22
- const path = index >= 0 ? arguments_[index] : cwd();
23
- if (!path || path.length === 0) {
24
- continue;
25
- }
26
- resolvedPath = `${path}/${resolvedPath}`;
27
- resolvedAbsolute = isAbsolute(path);
28
- }
29
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
30
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
31
- return `/${resolvedPath}`;
32
- }
33
- return resolvedPath.length > 0 ? resolvedPath : ".";
34
- };
35
- function normalizeString(path, allowAboveRoot) {
36
- let res = "";
37
- let lastSegmentLength = 0;
38
- let lastSlash = -1;
39
- let dots = 0;
40
- let char = null;
41
- for (let index = 0; index <= path.length; ++index) {
42
- if (index < path.length) {
43
- char = path[index];
44
- } else if (char === "/") {
45
- break;
46
- } else {
47
- char = "/";
48
- }
49
- if (char === "/") {
50
- if (lastSlash === index - 1 || dots === 1) ;
51
- else if (dots === 2) {
52
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
53
- if (res.length > 2) {
54
- const lastSlashIndex = res.lastIndexOf("/");
55
- if (lastSlashIndex === -1) {
56
- res = "";
57
- lastSegmentLength = 0;
58
- } else {
59
- res = res.slice(0, lastSlashIndex);
60
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
61
- }
62
- lastSlash = index;
63
- dots = 0;
64
- continue;
65
- } else if (res.length > 0) {
66
- res = "";
67
- lastSegmentLength = 0;
68
- lastSlash = index;
69
- dots = 0;
70
- continue;
71
- }
72
- }
73
- if (allowAboveRoot) {
74
- res += res.length > 0 ? "/.." : "..";
75
- lastSegmentLength = 2;
76
- }
77
- } else {
78
- if (res.length > 0) {
79
- res += `/${path.slice(lastSlash + 1, index)}`;
80
- } else {
81
- res = path.slice(lastSlash + 1, index);
82
- }
83
- lastSegmentLength = index - lastSlash - 1;
84
- }
85
- lastSlash = index;
86
- dots = 0;
87
- } else if (char === "." && dots !== -1) {
88
- ++dots;
89
- } else {
90
- dots = -1;
91
- }
92
- }
93
- return res;
94
- }
95
- const isAbsolute = function(p) {
96
- return _IS_ABSOLUTE_RE.test(p);
97
- };
98
- exports.a = normalizeString;
99
- exports.g = normalizeWindowsPath;
100
- exports.i = isAbsolute;
101
- exports.r = resolve;
@@ -1,101 +0,0 @@
1
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
- function normalizeWindowsPath(input = "") {
3
- if (!input) {
4
- return input;
5
- }
6
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
- }
8
- const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
9
- function cwd() {
10
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
11
- return process.cwd().replace(/\\/g, "/");
12
- }
13
- return "/";
14
- }
15
- const resolve = function(...arguments_) {
16
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
17
- let resolvedPath = "";
18
- let resolvedAbsolute = false;
19
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
20
- const path = index >= 0 ? arguments_[index] : cwd();
21
- if (!path || path.length === 0) {
22
- continue;
23
- }
24
- resolvedPath = `${path}/${resolvedPath}`;
25
- resolvedAbsolute = isAbsolute(path);
26
- }
27
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
28
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
29
- return `/${resolvedPath}`;
30
- }
31
- return resolvedPath.length > 0 ? resolvedPath : ".";
32
- };
33
- function normalizeString(path, allowAboveRoot) {
34
- let res = "";
35
- let lastSegmentLength = 0;
36
- let lastSlash = -1;
37
- let dots = 0;
38
- let char = null;
39
- for (let index = 0; index <= path.length; ++index) {
40
- if (index < path.length) {
41
- char = path[index];
42
- } else if (char === "/") {
43
- break;
44
- } else {
45
- char = "/";
46
- }
47
- if (char === "/") {
48
- if (lastSlash === index - 1 || dots === 1) ;
49
- else if (dots === 2) {
50
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
51
- if (res.length > 2) {
52
- const lastSlashIndex = res.lastIndexOf("/");
53
- if (lastSlashIndex === -1) {
54
- res = "";
55
- lastSegmentLength = 0;
56
- } else {
57
- res = res.slice(0, lastSlashIndex);
58
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
59
- }
60
- lastSlash = index;
61
- dots = 0;
62
- continue;
63
- } else if (res.length > 0) {
64
- res = "";
65
- lastSegmentLength = 0;
66
- lastSlash = index;
67
- dots = 0;
68
- continue;
69
- }
70
- }
71
- if (allowAboveRoot) {
72
- res += res.length > 0 ? "/.." : "..";
73
- lastSegmentLength = 2;
74
- }
75
- } else {
76
- if (res.length > 0) {
77
- res += `/${path.slice(lastSlash + 1, index)}`;
78
- } else {
79
- res = path.slice(lastSlash + 1, index);
80
- }
81
- lastSegmentLength = index - lastSlash - 1;
82
- }
83
- lastSlash = index;
84
- dots = 0;
85
- } else if (char === "." && dots !== -1) {
86
- ++dots;
87
- } else {
88
- dots = -1;
89
- }
90
- }
91
- return res;
92
- }
93
- const isAbsolute = function(p) {
94
- return _IS_ABSOLUTE_RE.test(p);
95
- };
96
- export {
97
- normalizeString as a,
98
- normalizeWindowsPath as g,
99
- isAbsolute as i,
100
- resolve as r
101
- };
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- var d = {
4
- reset: [0, 0],
5
- bold: [1, 22, "\x1B[22m\x1B[1m"],
6
- dim: [2, 22, "\x1B[22m\x1B[2m"],
7
- italic: [3, 23],
8
- underline: [4, 24],
9
- inverse: [7, 27],
10
- hidden: [8, 28],
11
- strikethrough: [9, 29],
12
- black: [30, 39],
13
- red: [31, 39],
14
- green: [32, 39],
15
- yellow: [33, 39],
16
- blue: [34, 39],
17
- magenta: [35, 39],
18
- cyan: [36, 39],
19
- white: [37, 39],
20
- gray: [90, 39],
21
- bgBlack: [40, 49],
22
- bgRed: [41, 49],
23
- bgGreen: [42, 49],
24
- bgYellow: [43, 49],
25
- bgBlue: [44, 49],
26
- bgMagenta: [45, 49],
27
- bgCyan: [46, 49],
28
- bgWhite: [47, 49],
29
- blackBright: [90, 39],
30
- redBright: [91, 39],
31
- greenBright: [92, 39],
32
- yellowBright: [93, 39],
33
- blueBright: [94, 39],
34
- magentaBright: [95, 39],
35
- cyanBright: [96, 39],
36
- whiteBright: [97, 39],
37
- bgBlackBright: [100, 49],
38
- bgRedBright: [101, 49],
39
- bgGreenBright: [102, 49],
40
- bgYellowBright: [103, 49],
41
- bgBlueBright: [104, 49],
42
- bgMagentaBright: [105, 49],
43
- bgCyanBright: [106, 49],
44
- bgWhiteBright: [107, 49]
45
- };
46
- function g(e) {
47
- return String(e);
48
- }
49
- g.open = "";
50
- g.close = "";
51
- function h() {
52
- let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
53
- return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
54
- }
55
- function f() {
56
- let e = h(), n = (r, t, u, o) => {
57
- let l = "", s = 0;
58
- do
59
- l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
60
- while (~o);
61
- return l + r.substring(s);
62
- }, a = (r, t, u = r) => {
63
- let o = (l) => {
64
- let s = String(l), b = s.indexOf(t, r.length);
65
- return ~b ? r + n(s, t, u, b) + t : r + s + t;
66
- };
67
- return o.open = r, o.close = t, o;
68
- }, i = {
69
- isColorSupported: e
70
- }, c = (r) => `\x1B[${r}m`;
71
- for (let r in d) {
72
- let t = d[r];
73
- i[r] = e ? a(
74
- c(t[0]),
75
- c(t[1]),
76
- t[2]
77
- ) : g;
78
- }
79
- return i;
80
- }
81
- var C = f();
82
- exports.createColors = f;
83
- exports.default = C;
84
- exports.isSupported = h;
@@ -1,84 +0,0 @@
1
- var d = {
2
- reset: [0, 0],
3
- bold: [1, 22, "\x1B[22m\x1B[1m"],
4
- dim: [2, 22, "\x1B[22m\x1B[2m"],
5
- italic: [3, 23],
6
- underline: [4, 24],
7
- inverse: [7, 27],
8
- hidden: [8, 28],
9
- strikethrough: [9, 29],
10
- black: [30, 39],
11
- red: [31, 39],
12
- green: [32, 39],
13
- yellow: [33, 39],
14
- blue: [34, 39],
15
- magenta: [35, 39],
16
- cyan: [36, 39],
17
- white: [37, 39],
18
- gray: [90, 39],
19
- bgBlack: [40, 49],
20
- bgRed: [41, 49],
21
- bgGreen: [42, 49],
22
- bgYellow: [43, 49],
23
- bgBlue: [44, 49],
24
- bgMagenta: [45, 49],
25
- bgCyan: [46, 49],
26
- bgWhite: [47, 49],
27
- blackBright: [90, 39],
28
- redBright: [91, 39],
29
- greenBright: [92, 39],
30
- yellowBright: [93, 39],
31
- blueBright: [94, 39],
32
- magentaBright: [95, 39],
33
- cyanBright: [96, 39],
34
- whiteBright: [97, 39],
35
- bgBlackBright: [100, 49],
36
- bgRedBright: [101, 49],
37
- bgGreenBright: [102, 49],
38
- bgYellowBright: [103, 49],
39
- bgBlueBright: [104, 49],
40
- bgMagentaBright: [105, 49],
41
- bgCyanBright: [106, 49],
42
- bgWhiteBright: [107, 49]
43
- };
44
- function g(e) {
45
- return String(e);
46
- }
47
- g.open = "";
48
- g.close = "";
49
- function h() {
50
- let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
51
- return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
52
- }
53
- function f() {
54
- let e = h(), n = (r, t, u, o) => {
55
- let l = "", s = 0;
56
- do
57
- l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
58
- while (~o);
59
- return l + r.substring(s);
60
- }, a = (r, t, u = r) => {
61
- let o = (l) => {
62
- let s = String(l), b = s.indexOf(t, r.length);
63
- return ~b ? r + n(s, t, u, b) + t : r + s + t;
64
- };
65
- return o.open = r, o.close = t, o;
66
- }, i = {
67
- isColorSupported: e
68
- }, c = (r) => `\x1B[${r}m`;
69
- for (let r in d) {
70
- let t = d[r];
71
- i[r] = e ? a(
72
- c(t[0]),
73
- c(t[1]),
74
- t[2]
75
- ) : g;
76
- }
77
- return i;
78
- }
79
- var C = f();
80
- export {
81
- f as createColors,
82
- C as default,
83
- h as isSupported
84
- };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
- exports.c = commonjsGlobal;
@@ -1,4 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2
- export {
3
- commonjsGlobal as c
4
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const RealDate = Date;
4
- let now = null;
5
- class MockDate extends RealDate {
6
- constructor(y, m, d, h, M, s, ms) {
7
- super();
8
- let date;
9
- switch (arguments.length) {
10
- case 0:
11
- if (now !== null) date = new RealDate(now.valueOf());
12
- else date = new RealDate();
13
- break;
14
- case 1:
15
- date = new RealDate(y);
16
- break;
17
- default:
18
- d = typeof d === "undefined" ? 1 : d;
19
- h = h || 0;
20
- M = M || 0;
21
- s = s || 0;
22
- ms = ms || 0;
23
- date = new RealDate(y, m, d, h, M, s, ms);
24
- break;
25
- }
26
- Object.setPrototypeOf(date, MockDate.prototype);
27
- return date;
28
- }
29
- }
30
- MockDate.UTC = RealDate.UTC;
31
- MockDate.now = function() {
32
- return new MockDate().valueOf();
33
- };
34
- MockDate.parse = function(dateString) {
35
- return RealDate.parse(dateString);
36
- };
37
- MockDate.toString = function() {
38
- return RealDate.toString();
39
- };
40
- function mockDate(date) {
41
- const dateObj = new RealDate(date.valueOf());
42
- if (Number.isNaN(dateObj.getTime())) throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
43
- globalThis.Date = MockDate;
44
- now = dateObj.valueOf();
45
- }
46
- function resetDate() {
47
- globalThis.Date = RealDate;
48
- }
49
- exports.R = RealDate;
50
- exports.m = mockDate;
51
- exports.r = resetDate;
@@ -1,51 +0,0 @@
1
- const RealDate = Date;
2
- let now = null;
3
- class MockDate extends RealDate {
4
- constructor(y, m, d, h, M, s, ms) {
5
- super();
6
- let date;
7
- switch (arguments.length) {
8
- case 0:
9
- if (now !== null) date = new RealDate(now.valueOf());
10
- else date = new RealDate();
11
- break;
12
- case 1:
13
- date = new RealDate(y);
14
- break;
15
- default:
16
- d = typeof d === "undefined" ? 1 : d;
17
- h = h || 0;
18
- M = M || 0;
19
- s = s || 0;
20
- ms = ms || 0;
21
- date = new RealDate(y, m, d, h, M, s, ms);
22
- break;
23
- }
24
- Object.setPrototypeOf(date, MockDate.prototype);
25
- return date;
26
- }
27
- }
28
- MockDate.UTC = RealDate.UTC;
29
- MockDate.now = function() {
30
- return new MockDate().valueOf();
31
- };
32
- MockDate.parse = function(dateString) {
33
- return RealDate.parse(dateString);
34
- };
35
- MockDate.toString = function() {
36
- return RealDate.toString();
37
- };
38
- function mockDate(date) {
39
- const dateObj = new RealDate(date.valueOf());
40
- if (Number.isNaN(dateObj.getTime())) throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
41
- globalThis.Date = MockDate;
42
- now = dateObj.valueOf();
43
- }
44
- function resetDate() {
45
- globalThis.Date = RealDate;
46
- }
47
- export {
48
- RealDate as R,
49
- mockDate as m,
50
- resetDate as r
51
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const timers = require("../../../../../@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.cjs");
4
- const NAME_WORKER_STATE = "__vitest_worker__";
5
- function getWorkerState() {
6
- const workerState = globalThis[NAME_WORKER_STATE];
7
- if (!workerState) throw new Error('Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- "vitest" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n');
8
- return workerState;
9
- }
10
- function isChildProcess() {
11
- return typeof process !== "undefined" && !!process.send;
12
- }
13
- function resetModules(modules, resetMocks = false) {
14
- const skipPaths = [
15
- /\/vitest\/dist\//,
16
- /vitest-virtual-\w+\/dist/,
17
- /@vitest\/dist/,
18
- ...!resetMocks ? [/^mock:/] : []
19
- ];
20
- modules.idToModuleMap.forEach((node, path) => {
21
- if (skipPaths.some((re) => re.test(path))) return;
22
- node.promise = void 0;
23
- node.exports = void 0;
24
- node.evaluated = false;
25
- node.importers.clear();
26
- });
27
- }
28
- function waitNextTick() {
29
- const { setTimeout } = timers.getSafeTimers();
30
- return new Promise((resolve) => setTimeout(resolve, 0));
31
- }
32
- async function waitForImportsToResolve() {
33
- await waitNextTick();
34
- const state = getWorkerState();
35
- const promises = [];
36
- const resolvingCount = state.resolvingModules.size;
37
- for (const [_, mod] of state.evaluatedModules.idToModuleMap) if (mod.promise && !mod.evaluated) promises.push(mod.promise);
38
- if (!promises.length && !resolvingCount) return;
39
- await Promise.allSettled(promises);
40
- await waitForImportsToResolve();
41
- }
42
- exports.g = getWorkerState;
43
- exports.i = isChildProcess;
44
- exports.r = resetModules;
45
- exports.w = waitForImportsToResolve;
@@ -1,45 +0,0 @@
1
- import { getSafeTimers } from "../../../../../@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.mjs";
2
- const NAME_WORKER_STATE = "__vitest_worker__";
3
- function getWorkerState() {
4
- const workerState = globalThis[NAME_WORKER_STATE];
5
- if (!workerState) throw new Error('Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- "vitest" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n');
6
- return workerState;
7
- }
8
- function isChildProcess() {
9
- return typeof process !== "undefined" && !!process.send;
10
- }
11
- function resetModules(modules, resetMocks = false) {
12
- const skipPaths = [
13
- /\/vitest\/dist\//,
14
- /vitest-virtual-\w+\/dist/,
15
- /@vitest\/dist/,
16
- ...!resetMocks ? [/^mock:/] : []
17
- ];
18
- modules.idToModuleMap.forEach((node, path) => {
19
- if (skipPaths.some((re) => re.test(path))) return;
20
- node.promise = void 0;
21
- node.exports = void 0;
22
- node.evaluated = false;
23
- node.importers.clear();
24
- });
25
- }
26
- function waitNextTick() {
27
- const { setTimeout } = getSafeTimers();
28
- return new Promise((resolve) => setTimeout(resolve, 0));
29
- }
30
- async function waitForImportsToResolve() {
31
- await waitNextTick();
32
- const state = getWorkerState();
33
- const promises = [];
34
- const resolvingCount = state.resolvingModules.size;
35
- for (const [_, mod] of state.evaluatedModules.idToModuleMap) if (mod.promise && !mod.evaluated) promises.push(mod.promise);
36
- if (!promises.length && !resolvingCount) return;
37
- await Promise.allSettled(promises);
38
- await waitForImportsToResolve();
39
- }
40
- export {
41
- getWorkerState as g,
42
- isChildProcess as i,
43
- resetModules as r,
44
- waitForImportsToResolve as w
45
- };