elit 3.6.6 → 3.6.7

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 (153) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/dist/build.cjs +421 -331
  4. package/dist/build.d.ts +1 -19
  5. package/dist/build.js +420 -330
  6. package/dist/build.mjs +420 -330
  7. package/dist/chokidar.cjs +219 -182
  8. package/dist/chokidar.d.ts +25 -10
  9. package/dist/chokidar.js +217 -182
  10. package/dist/chokidar.mjs +218 -183
  11. package/dist/cli.cjs +22439 -21563
  12. package/dist/cli.d.ts +19 -37
  13. package/dist/cli.mjs +24113 -23252
  14. package/dist/config.cjs +357 -350
  15. package/dist/config.d.ts +17 -245
  16. package/dist/config.js +520 -515
  17. package/dist/config.mjs +346 -341
  18. package/dist/contracts-BeW9k0yZ.d.ts +54 -0
  19. package/dist/contracts-D7KIS-TK.d.ts +36 -0
  20. package/dist/coverage.cjs +448 -485
  21. package/dist/coverage.d.ts +13 -62
  22. package/dist/coverage.js +447 -484
  23. package/dist/coverage.mjs +447 -484
  24. package/dist/database.cjs +819 -828
  25. package/dist/database.d.ts +8 -24
  26. package/dist/database.js +818 -829
  27. package/dist/database.mjs +818 -829
  28. package/dist/desktop-auto-render.cjs +1700 -1523
  29. package/dist/desktop-auto-render.d.ts +4 -12
  30. package/dist/desktop-auto-render.js +1695 -1518
  31. package/dist/desktop-auto-render.mjs +1696 -1519
  32. package/dist/desktop.cjs +3 -1
  33. package/dist/desktop.d.ts +4 -1
  34. package/dist/desktop.js +1 -1
  35. package/dist/desktop.mjs +1 -1
  36. package/dist/dev-build.cjs +830 -0
  37. package/dist/dev-build.d.ts +53 -0
  38. package/dist/dev-build.js +3318 -0
  39. package/dist/dev-build.mjs +797 -0
  40. package/dist/dom.cjs +717 -591
  41. package/dist/dom.d.ts +2 -17
  42. package/dist/dom.js +714 -588
  43. package/dist/dom.mjs +716 -590
  44. package/dist/el.cjs +62 -52
  45. package/dist/el.d.ts +5 -12
  46. package/dist/el.js +60 -52
  47. package/dist/el.mjs +60 -52
  48. package/dist/fs.cjs +72 -63
  49. package/dist/fs.d.ts +22 -19
  50. package/dist/fs.js +71 -62
  51. package/dist/fs.mjs +71 -62
  52. package/dist/hmr.cjs +40 -14
  53. package/dist/hmr.d.ts +11 -23
  54. package/dist/hmr.js +38 -14
  55. package/dist/hmr.mjs +38 -14
  56. package/dist/http.cjs +251 -99
  57. package/dist/http.d.ts +38 -104
  58. package/dist/http.js +249 -99
  59. package/dist/http.mjs +249 -99
  60. package/dist/https.cjs +524 -228
  61. package/dist/https.d.ts +44 -36
  62. package/dist/https.js +520 -226
  63. package/dist/https.mjs +522 -228
  64. package/dist/index.cjs +7502 -7691
  65. package/dist/index.d.ts +6 -3
  66. package/dist/index.js +7486 -7677
  67. package/dist/index.mjs +7497 -7687
  68. package/dist/mime-types.cjs +10 -4
  69. package/dist/mime-types.d.ts +8 -11
  70. package/dist/mime-types.js +9 -3
  71. package/dist/mime-types.mjs +9 -3
  72. package/dist/native.cjs +8616 -8870
  73. package/dist/native.d.ts +7 -10
  74. package/dist/native.js +8682 -8936
  75. package/dist/native.mjs +8615 -8869
  76. package/dist/path.cjs +83 -77
  77. package/dist/path.d.ts +29 -29
  78. package/dist/path.js +82 -76
  79. package/dist/path.mjs +82 -76
  80. package/dist/pm.cjs +3300 -0
  81. package/dist/pm.d.ts +256 -0
  82. package/dist/pm.js +5638 -0
  83. package/dist/pm.mjs +3196 -0
  84. package/dist/preview-build.cjs +712 -0
  85. package/dist/preview-build.d.ts +59 -0
  86. package/dist/preview-build.js +3194 -0
  87. package/dist/preview-build.mjs +676 -0
  88. package/dist/render-context.cjs +13 -2
  89. package/dist/render-context.d.ts +9 -34
  90. package/dist/render-context.js +11 -2
  91. package/dist/render-context.mjs +11 -2
  92. package/dist/router.cjs +787 -646
  93. package/dist/router.d.ts +8 -14
  94. package/dist/router.js +786 -645
  95. package/dist/router.mjs +786 -645
  96. package/dist/runtime.cjs +1 -1
  97. package/dist/runtime.js +1 -1
  98. package/dist/runtime.mjs +1 -1
  99. package/dist/server.cjs +3254 -2684
  100. package/dist/server.d.ts +47 -5
  101. package/dist/server.js +3427 -2859
  102. package/dist/server.mjs +3397 -2829
  103. package/dist/smtp-server.cjs +16 -3
  104. package/dist/smtp-server.d.ts +12 -26
  105. package/dist/smtp-server.js +18 -5
  106. package/dist/smtp-server.mjs +16 -3
  107. package/dist/state-DvEkDehk.d.ts +195 -0
  108. package/dist/state.cjs +768 -659
  109. package/dist/state.d.ts +11 -71
  110. package/dist/state.js +760 -651
  111. package/dist/state.mjs +767 -658
  112. package/dist/style.cjs +1011 -968
  113. package/dist/style.d.ts +13 -127
  114. package/dist/style.js +1009 -970
  115. package/dist/style.mjs +1011 -971
  116. package/dist/test-reporter.cjs +332 -316
  117. package/dist/test-reporter.d.ts +28 -33
  118. package/dist/test-reporter.js +328 -312
  119. package/dist/test-reporter.mjs +328 -312
  120. package/dist/test-runtime.cjs +927 -968
  121. package/dist/test-runtime.d.ts +24 -99
  122. package/dist/test-runtime.js +922 -965
  123. package/dist/test-runtime.mjs +922 -965
  124. package/dist/test.cjs +4428 -4273
  125. package/dist/test.d.ts +2 -8
  126. package/dist/test.js +4307 -4154
  127. package/dist/test.mjs +4419 -4267
  128. package/dist/types-BONVzPtp.d.ts +59 -0
  129. package/dist/types-BR4wMiVx.d.ts +32 -0
  130. package/dist/types-C4gKykuG.d.ts +23 -0
  131. package/dist/types-CIhpN1-K.d.ts +64 -0
  132. package/dist/types-Ckj8md_j.d.ts +84 -0
  133. package/dist/types-CpjQTAkX.d.ts +24 -0
  134. package/dist/types-D0LjrYjS.d.ts +14 -0
  135. package/dist/types-DAisuVr5.d.ts +75 -0
  136. package/dist/types-tJn88E1N.d.ts +242 -0
  137. package/dist/types.d.ts +50 -237
  138. package/dist/universal.cjs +1 -1
  139. package/dist/universal.d.ts +1 -7
  140. package/dist/universal.js +1 -1
  141. package/dist/universal.mjs +1 -1
  142. package/dist/websocket-XfyK23zD.d.ts +119 -0
  143. package/dist/ws.cjs +129 -108
  144. package/dist/ws.d.ts +21 -131
  145. package/dist/ws.js +128 -109
  146. package/dist/ws.mjs +128 -109
  147. package/dist/wss.cjs +757 -479
  148. package/dist/wss.d.ts +31 -28
  149. package/dist/wss.js +755 -479
  150. package/dist/wss.mjs +758 -482
  151. package/package.json +8 -1
  152. package/vendor/epaint-0.31.1/src/image.rs +418 -0
  153. package/dist/server-uMQvZAll.d.ts +0 -458
@@ -1,6 +1,6 @@
1
1
  import {createRequire as __createRequire} from 'module';const require = __createRequire(import.meta.url);
2
2
 
3
- // src/runtime.ts
3
+ // src/shares/runtime.ts
4
4
  var runtime = (() => {
5
5
  if (typeof Deno !== "undefined") return "deno";
6
6
  if (typeof Bun !== "undefined") return "bun";
@@ -10,37 +10,33 @@ var isNode = runtime === "node";
10
10
  var isBun = runtime === "bun";
11
11
  var isDeno = runtime === "deno";
12
12
 
13
- // src/path.ts
13
+ // src/server/path/platform.ts
14
14
  function getSeparator(isWin) {
15
15
  return isWin ? "\\" : "/";
16
16
  }
17
17
  function getCwd() {
18
18
  if (isNode || isBun) {
19
19
  return process.cwd();
20
- } else if (isDeno) {
20
+ }
21
+ if (isDeno) {
21
22
  return Deno.cwd();
22
23
  }
23
24
  return "/";
24
25
  }
26
+ var isWindows = (() => {
27
+ if (isNode) {
28
+ return process.platform === "win32";
29
+ }
30
+ if (isDeno) {
31
+ return Deno.build.os === "windows";
32
+ }
33
+ return typeof process !== "undefined" && process.platform === "win32";
34
+ })();
35
+
36
+ // src/server/path/operations.ts
25
37
  function findLastSeparator(path) {
26
38
  return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
27
39
  }
28
- function createPathOps(isWin) {
29
- return {
30
- sep: getSeparator(isWin),
31
- delimiter: isWin ? ";" : ":",
32
- normalize: (path) => normalizePath(path, isWin),
33
- join: (...paths) => joinPaths(paths, isWin),
34
- resolve: (...paths) => resolvePaths(paths, isWin),
35
- isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
36
- relative: (from, to) => relativePath(from, to, isWin),
37
- dirname: (path) => getDirname(path, isWin),
38
- basename: (path, ext) => getBasename(path, ext, isWin),
39
- extname: (path) => getExtname(path),
40
- parse: (path) => parsePath(path, isWin),
41
- format: (pathObject) => formatPath(pathObject, isWin)
42
- };
43
- }
44
40
  function isAbsolutePosix(path) {
45
41
  return path.length > 0 && path[0] === "/";
46
42
  }
@@ -61,28 +57,18 @@ function isAbsoluteWin(path) {
61
57
  }
62
58
  return false;
63
59
  }
64
- var isWindows = (() => {
65
- if (isNode) {
66
- return process.platform === "win32";
67
- } else if (isDeno) {
68
- return Deno.build.os === "windows";
69
- }
70
- return typeof process !== "undefined" && process.platform === "win32";
71
- })();
72
- var posix = createPathOps(false);
73
- var win32 = createPathOps(true);
74
60
  function normalizePath(path, isWin) {
75
61
  if (path.length === 0) return ".";
76
62
  const separator = getSeparator(isWin);
77
63
  const isAbsolute = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
78
64
  const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
79
- let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
65
+ const normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
80
66
  const parts = normalized.split(separator);
81
67
  const result = [];
82
- for (let i = 0; i < parts.length; i++) {
83
- const part = parts[i];
68
+ for (let index = 0; index < parts.length; index++) {
69
+ const part = parts[index];
84
70
  if (part === "" || part === ".") {
85
- if (i === 0 && isAbsolute) result.push("");
71
+ if (index === 0 && isAbsolute) result.push("");
86
72
  continue;
87
73
  }
88
74
  if (part === "..") {
@@ -97,21 +83,21 @@ function normalizePath(path, isWin) {
97
83
  result.push(part);
98
84
  }
99
85
  }
100
- let final = result.join(separator);
101
- if (final.length === 0) {
86
+ let finalPath = result.join(separator);
87
+ if (finalPath.length === 0) {
102
88
  return isAbsolute ? separator : ".";
103
89
  }
104
- if (trailingSeparator && final[final.length - 1] !== separator) {
105
- final += separator;
90
+ if (trailingSeparator && finalPath[finalPath.length - 1] !== separator) {
91
+ finalPath += separator;
106
92
  }
107
- return final;
93
+ return finalPath;
108
94
  }
109
95
  function joinPaths(paths, isWin) {
110
96
  if (paths.length === 0) return ".";
111
97
  const separator = getSeparator(isWin);
112
98
  let joined = "";
113
- for (let i = 0; i < paths.length; i++) {
114
- const path = paths[i];
99
+ for (let index = 0; index < paths.length; index++) {
100
+ const path = paths[index];
115
101
  if (path && path.length > 0) {
116
102
  if (joined.length === 0) {
117
103
  joined = path;
@@ -126,43 +112,43 @@ function joinPaths(paths, isWin) {
126
112
  function resolvePaths(paths, isWin) {
127
113
  const separator = getSeparator(isWin);
128
114
  let resolved = "";
129
- let isAbsolute = false;
130
- for (let i = paths.length - 1; i >= 0 && !isAbsolute; i--) {
131
- const path = paths[i];
115
+ let absolute = false;
116
+ for (let index = paths.length - 1; index >= 0 && !absolute; index--) {
117
+ const path = paths[index];
132
118
  if (path && path.length > 0) {
133
119
  resolved = path + (resolved.length > 0 ? separator + resolved : "");
134
- isAbsolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
120
+ absolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
135
121
  }
136
122
  }
137
- if (!isAbsolute) {
123
+ if (!absolute) {
138
124
  const cwd = getCwd();
139
125
  resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
140
126
  }
141
127
  return normalizePath(resolved, isWin);
142
128
  }
143
129
  function relativePath(from, to, isWin) {
144
- from = resolvePaths([from], isWin);
145
- to = resolvePaths([to], isWin);
146
- if (from === to) return "";
130
+ const resolvedFrom = resolvePaths([from], isWin);
131
+ const resolvedTo = resolvePaths([to], isWin);
132
+ if (resolvedFrom === resolvedTo) return "";
147
133
  const separator = getSeparator(isWin);
148
- const fromParts = from.split(separator).filter((p) => p.length > 0);
149
- const toParts = to.split(separator).filter((p) => p.length > 0);
150
- let commonLength = 0;
134
+ const fromParts = resolvedFrom.split(separator).filter((part) => part.length > 0);
135
+ const toParts = resolvedTo.split(separator).filter((part) => part.length > 0);
151
136
  const minLength = Math.min(fromParts.length, toParts.length);
152
- for (let i = 0; i < minLength; i++) {
153
- if (fromParts[i] === toParts[i]) {
137
+ let commonLength = 0;
138
+ for (let index = 0; index < minLength; index++) {
139
+ if (fromParts[index] === toParts[index]) {
154
140
  commonLength++;
155
141
  } else {
156
142
  break;
157
143
  }
158
144
  }
159
- const upCount = fromParts.length - commonLength;
160
145
  const result = [];
161
- for (let i = 0; i < upCount; i++) {
146
+ const upCount = fromParts.length - commonLength;
147
+ for (let index = 0; index < upCount; index++) {
162
148
  result.push("..");
163
149
  }
164
- for (let i = commonLength; i < toParts.length; i++) {
165
- result.push(toParts[i]);
150
+ for (let index = commonLength; index < toParts.length; index++) {
151
+ result.push(toParts[index]);
166
152
  }
167
153
  return result.join(separator) || ".";
168
154
  }
@@ -170,15 +156,15 @@ function getDirname(path, isWin) {
170
156
  if (path.length === 0) return ".";
171
157
  const separator = getSeparator(isWin);
172
158
  const normalized = normalizePath(path, isWin);
173
- const lastSepIndex = normalized.lastIndexOf(separator);
174
- if (lastSepIndex === -1) return ".";
175
- if (lastSepIndex === 0) return separator;
176
- return normalized.slice(0, lastSepIndex);
159
+ const lastSeparatorIndex = normalized.lastIndexOf(separator);
160
+ if (lastSeparatorIndex === -1) return ".";
161
+ if (lastSeparatorIndex === 0) return separator;
162
+ return normalized.slice(0, lastSeparatorIndex);
177
163
  }
178
164
  function getBasename(path, ext, isWin) {
179
165
  if (path.length === 0) return "";
180
- const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
181
- let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
166
+ const lastSeparatorIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
167
+ let base = lastSeparatorIndex === -1 ? path : path.slice(lastSeparatorIndex + 1);
182
168
  if (ext && base.endsWith(ext)) {
183
169
  base = base.slice(0, base.length - ext.length);
184
170
  }
@@ -186,8 +172,8 @@ function getBasename(path, ext, isWin) {
186
172
  }
187
173
  function getExtname(path) {
188
174
  const lastDotIndex = path.lastIndexOf(".");
189
- const lastSepIndex = findLastSeparator(path);
190
- if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
175
+ const lastSeparatorIndex = findLastSeparator(path);
176
+ if (lastDotIndex === -1 || lastDotIndex < lastSeparatorIndex || lastDotIndex === path.length - 1) {
191
177
  return "";
192
178
  }
193
179
  return path.slice(lastDotIndex);
@@ -203,10 +189,8 @@ function parsePath(path, isWin) {
203
189
  } else if (path[0] === "\\" || path[0] === "/") {
204
190
  root = "\\";
205
191
  }
206
- } else {
207
- if (path[0] === "/") {
208
- root = "/";
209
- }
192
+ } else if (path[0] === "/") {
193
+ root = "/";
210
194
  }
211
195
  const dir = getDirname(path, isWin);
212
196
  const base = getBasename(path, void 0, isWin);
@@ -222,11 +206,31 @@ function formatPath(pathObject, isWin) {
222
206
  if (dir === pathObject.root) return dir + base;
223
207
  return dir + separator + base;
224
208
  }
209
+ function createPathOps(isWin) {
210
+ return {
211
+ sep: getSeparator(isWin),
212
+ delimiter: isWin ? ";" : ":",
213
+ normalize: (path) => normalizePath(path, isWin),
214
+ join: (...paths) => joinPaths(paths, isWin),
215
+ resolve: (...paths) => resolvePaths(paths, isWin),
216
+ isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
217
+ relative: (from, to) => relativePath(from, to, isWin),
218
+ dirname: (path) => getDirname(path, isWin),
219
+ basename: (path, ext) => getBasename(path, ext, isWin),
220
+ extname: (path) => getExtname(path),
221
+ parse: (path) => parsePath(path, isWin),
222
+ format: (pathObject) => formatPath(pathObject, isWin)
223
+ };
224
+ }
225
+
226
+ // src/server/path/index.ts
227
+ var posix = createPathOps(false);
228
+ var win32 = createPathOps(true);
225
229
  function relative(from, to) {
226
230
  return relativePath(from, to, isWindows);
227
231
  }
228
232
 
229
- // src/test-reporter.ts
233
+ // src/test/reporter/colors.ts
230
234
  var colors = {
231
235
  reset: "\x1B[0m",
232
236
  bold: "\x1B[1m",
@@ -238,68 +242,220 @@ var colors = {
238
242
  cyan: "\x1B[36m",
239
243
  white: "\x1B[37m"
240
244
  };
245
+ function colorize(color, text, enabled = true) {
246
+ return enabled ? colors[color] + text + colors.reset : text;
247
+ }
248
+
249
+ // src/test/reporter/suggestions.ts
241
250
  function extractArg(code, functionName) {
242
- const searchStr = `.${functionName}(`;
243
- const startIndex = code.indexOf(searchStr);
251
+ const searchString = `.${functionName}(`;
252
+ const startIndex = code.indexOf(searchString);
244
253
  if (startIndex === -1) return null;
245
254
  let parenCount = 0;
246
255
  let inString = false;
247
256
  let stringChar = "";
248
- let argStart = startIndex + searchStr.length;
249
- for (let i = argStart; i < code.length; i++) {
250
- const char = code[i];
257
+ const argumentStart = startIndex + searchString.length;
258
+ for (let index = argumentStart; index < code.length; index++) {
259
+ const char = code[index];
251
260
  if (!inString) {
252
- if (char === "(") parenCount++;
253
- else if (char === ")") {
261
+ if (char === "(") {
262
+ parenCount++;
263
+ } else if (char === ")") {
254
264
  parenCount--;
255
265
  if (parenCount < 0) {
256
- return code.slice(argStart, i);
266
+ return code.slice(argumentStart, index);
257
267
  }
258
268
  } else if (char === '"' || char === "'" || char === "`") {
259
269
  inString = true;
260
270
  stringChar = char;
261
271
  }
262
- } else {
263
- if (char === "\\" && i + 1 < code.length) {
264
- i++;
265
- } else if (char === stringChar) {
266
- inString = false;
267
- }
272
+ } else if (char === "\\" && index + 1 < code.length) {
273
+ index++;
274
+ } else if (char === stringChar) {
275
+ inString = false;
268
276
  }
269
277
  }
270
278
  return null;
271
279
  }
272
- function extractReceivedValue(errorMsg) {
273
- const receivedIndex = errorMsg.indexOf("Received:");
280
+ function extractReceivedValue(errorMessage) {
281
+ const receivedIndex = errorMessage.indexOf("Received:");
274
282
  if (receivedIndex === -1) return null;
275
- const afterReceived = errorMsg.slice(receivedIndex + 9).trimStart();
283
+ const afterReceived = errorMessage.slice(receivedIndex + 9).trimStart();
276
284
  const newlineIndex = afterReceived.indexOf("\n");
277
285
  if (newlineIndex !== -1) {
278
286
  return afterReceived.slice(0, newlineIndex).trimEnd();
279
287
  }
280
288
  return afterReceived.trimEnd();
281
289
  }
282
- function parseQuotedString(str) {
283
- if (str.length < 2) return null;
284
- const firstChar = str[0];
285
- const lastChar = str[str.length - 1];
290
+ function parseQuotedString(value) {
291
+ if (value.length < 2) return null;
292
+ const firstChar = value[0];
293
+ const lastChar = value[value.length - 1];
286
294
  if ((firstChar === '"' || firstChar === "'" || firstChar === "`") && firstChar === lastChar) {
287
295
  return {
288
296
  quote: firstChar,
289
- content: str.slice(1, -1)
297
+ content: value.slice(1, -1)
290
298
  };
291
299
  }
292
300
  return null;
293
301
  }
294
- function stripQuotes(str) {
295
- if (str.length < 2) return str;
296
- const firstChar = str[0];
297
- const lastChar = str[str.length - 1];
302
+ function stripQuotes(value) {
303
+ if (value.length < 2) return value;
304
+ const firstChar = value[0];
305
+ const lastChar = value[value.length - 1];
298
306
  if ((firstChar === '"' || firstChar === "'" || firstChar === "`") && firstChar === lastChar) {
299
- return str.slice(1, -1);
307
+ return value.slice(1, -1);
300
308
  }
301
- return str;
309
+ return value;
302
310
  }
311
+ function buildSuggestion(code, errorMessage) {
312
+ const receivedValue = extractReceivedValue(errorMessage);
313
+ if (code.includes(".toBeGreaterThanOrEqual(")) {
314
+ const currentValue = extractArg(code, "toBeGreaterThanOrEqual");
315
+ if (currentValue && receivedValue) {
316
+ const actualValue = Number(receivedValue);
317
+ if (!Number.isNaN(actualValue)) {
318
+ return code.replace(
319
+ `.toBeGreaterThanOrEqual(${currentValue})`,
320
+ `.toBeGreaterThanOrEqual(${actualValue})`
321
+ );
322
+ }
323
+ }
324
+ } else if (code.includes(".toBeGreaterThan(")) {
325
+ const currentValue = extractArg(code, "toBeGreaterThan");
326
+ if (currentValue && receivedValue) {
327
+ const actualValue = Number(receivedValue);
328
+ if (!Number.isNaN(actualValue)) {
329
+ return code.replace(
330
+ `.toBeGreaterThan(${currentValue})`,
331
+ `.toBeGreaterThan(${actualValue - 1})`
332
+ );
333
+ }
334
+ }
335
+ } else if (code.includes(".toBeLessThanOrEqual(")) {
336
+ const currentValue = extractArg(code, "toBeLessThanOrEqual");
337
+ if (currentValue && receivedValue) {
338
+ const actualValue = Number(receivedValue);
339
+ if (!Number.isNaN(actualValue)) {
340
+ return code.replace(
341
+ `.toBeLessThanOrEqual(${currentValue})`,
342
+ `.toBeLessThanOrEqual(${actualValue})`
343
+ );
344
+ }
345
+ }
346
+ } else if (code.includes(".toBeLessThan(")) {
347
+ const currentValue = extractArg(code, "toBeLessThan");
348
+ if (currentValue && receivedValue) {
349
+ const actualValue = Number(receivedValue);
350
+ if (!Number.isNaN(actualValue)) {
351
+ return code.replace(
352
+ `.toBeLessThan(${currentValue})`,
353
+ `.toBeLessThan(${actualValue + 1})`
354
+ );
355
+ }
356
+ }
357
+ } else if (code.includes(".toStrictEqual(")) {
358
+ const expectedValue = extractArg(code, "toStrictEqual");
359
+ if (expectedValue && receivedValue) {
360
+ const quoted = parseQuotedString(expectedValue);
361
+ if (quoted) {
362
+ return code.replace(
363
+ `.toStrictEqual(${expectedValue})`,
364
+ `.toStrictEqual(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
365
+ );
366
+ }
367
+ return code.replace(
368
+ `.toStrictEqual(${expectedValue})`,
369
+ `.toStrictEqual(${receivedValue})`
370
+ );
371
+ }
372
+ } else if (code.includes(".toEqual(")) {
373
+ const expectedValue = extractArg(code, "toEqual");
374
+ if (expectedValue && receivedValue) {
375
+ const quoted = parseQuotedString(expectedValue);
376
+ if (quoted) {
377
+ return code.replace(
378
+ `.toEqual(${expectedValue})`,
379
+ `.toEqual(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
380
+ );
381
+ }
382
+ return code.replace(
383
+ `.toEqual(${expectedValue})`,
384
+ `.toEqual(${receivedValue})`
385
+ );
386
+ }
387
+ } else if (code.includes(".toMatch(")) {
388
+ const expectedPattern = extractArg(code, "toMatch");
389
+ if (expectedPattern && receivedValue) {
390
+ const quoted = parseQuotedString(expectedPattern);
391
+ if (quoted) {
392
+ return code.replace(
393
+ `.toMatch(${expectedPattern})`,
394
+ `.toMatch(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
395
+ );
396
+ }
397
+ }
398
+ } else if (code.includes(".toContain(")) {
399
+ const expectedValue = extractArg(code, "toContain");
400
+ if (expectedValue && receivedValue) {
401
+ const quoted = parseQuotedString(expectedValue);
402
+ if (quoted) {
403
+ return code.replace(
404
+ `.toContain(${expectedValue})`,
405
+ `.toContain(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
406
+ );
407
+ }
408
+ return code.replace(
409
+ `.toContain(${expectedValue})`,
410
+ `.toContain(${receivedValue})`
411
+ );
412
+ }
413
+ } else if (code.includes(".toHaveLength(")) {
414
+ const expectedLength = extractArg(code, "toHaveLength");
415
+ if (expectedLength && receivedValue) {
416
+ const actualLength = Number(receivedValue);
417
+ if (!Number.isNaN(actualLength)) {
418
+ return code.replace(
419
+ `.toHaveLength(${expectedLength})`,
420
+ `.toHaveLength(${actualLength})`
421
+ );
422
+ }
423
+ }
424
+ } else if (code.includes(".toBe(")) {
425
+ const expectedValue = extractArg(code, "toBe");
426
+ if (expectedValue) {
427
+ if (receivedValue) {
428
+ const quoted = parseQuotedString(expectedValue);
429
+ if (quoted) {
430
+ return code.replace(
431
+ `.toBe(${expectedValue})`,
432
+ `.toBe(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
433
+ );
434
+ }
435
+ return code.replace(
436
+ `.toBe(${expectedValue})`,
437
+ `.toBe(${receivedValue})`
438
+ );
439
+ }
440
+ if (expectedValue.includes("'") || expectedValue.includes('"')) {
441
+ return code.replace(".toBe(", ".toEqual(");
442
+ }
443
+ }
444
+ } else if (code.includes(".toBeDefined()")) {
445
+ return code.replace(".toBeDefined()", ".toBeTruthy()");
446
+ } else if (code.includes(".toBeNull()")) {
447
+ return code.replace(".toBeNull()", ".toBeUndefined()");
448
+ } else if (code.includes(".toBeUndefined()")) {
449
+ return code.replace(".toBeUndefined()", ".toBeNull()");
450
+ } else if (code.includes(".toBeTruthy()")) {
451
+ return code.replace(".toBeTruthy()", ".toBeDefined()");
452
+ } else if (code.includes(".toBeFalsy()")) {
453
+ return code.replace(".toBeFalsy()", ".toBeUndefined()");
454
+ }
455
+ return "";
456
+ }
457
+
458
+ // src/test/reporter/default-reporter.ts
303
459
  var TestReporter = class {
304
460
  constructor(options = {}) {
305
461
  this.startTime = 0;
@@ -313,7 +469,7 @@ var TestReporter = class {
313
469
  };
314
470
  }
315
471
  c(color, text) {
316
- return this.options.colors !== false ? colors[color] + text + colors.reset : text;
472
+ return colorize(color, text, this.options.colors !== false);
317
473
  }
318
474
  onRunStart(files) {
319
475
  this.startTime = Date.now();
@@ -339,202 +495,52 @@ ${this.c("bold", "Test Files")}: ${files.length}`);
339
495
  this.fileTestCount++;
340
496
  if (result.status === "pass") {
341
497
  console.log(` ${this.c("green", "\u2713")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("dim", `(${result.duration}ms)`)}`);
342
- } else if (result.status === "fail") {
498
+ return;
499
+ }
500
+ if (result.status === "fail") {
343
501
  console.log(` ${this.c("red", "\u2715")} ${this.c("dim", result.suite + " > ")}${result.name}`);
344
- if (result.error) {
345
- const filePath2 = result.file;
346
- if (filePath2) {
347
- const relativePath2 = relative(process.cwd(), filePath2).split("\\").join("/");
348
- const lineSuffix = result.lineNumber ? `:${result.lineNumber}` : "";
349
- console.log(` ${this.c("cyan", `\u{1F4C4} ${relativePath2}${lineSuffix}`)}`);
350
- }
351
- const lines = result.error.message.split("\n");
352
- for (const line of lines) {
353
- if (line.includes("Expected:")) {
354
- console.log(` ${this.c("green", "Expected:")} ${line.trim().replace("Expected:", "").trim()}`);
355
- } else if (line.includes("Received:")) {
356
- console.log(` ${this.c("red", "Received:")} ${line.trim().replace("Received:", "").trim()}`);
357
- } else {
358
- console.log(` ${this.c("red", line.trim())}`);
359
- }
360
- }
361
- if (result.codeSnippet) {
362
- let suggestion = "";
363
- const code = result.codeSnippet;
364
- const errorMsg = result.error?.message || "";
365
- const receivedValue = extractReceivedValue(errorMsg);
366
- if (code.includes(".toBeGreaterThanOrEqual(")) {
367
- const currentValue = extractArg(code, "toBeGreaterThanOrEqual");
368
- if (currentValue && receivedValue) {
369
- const actualValue = Number(receivedValue);
370
- if (!isNaN(actualValue)) {
371
- suggestion = code.replace(
372
- `.toBeGreaterThanOrEqual(${currentValue})`,
373
- `.toBeGreaterThanOrEqual(${actualValue})`
374
- );
375
- }
376
- }
377
- } else if (code.includes(".toBeGreaterThan(")) {
378
- const currentValue = extractArg(code, "toBeGreaterThan");
379
- if (currentValue && receivedValue) {
380
- const actualValue = Number(receivedValue);
381
- if (!isNaN(actualValue)) {
382
- suggestion = code.replace(
383
- `.toBeGreaterThan(${currentValue})`,
384
- `.toBeGreaterThan(${actualValue - 1})`
385
- );
386
- }
387
- }
388
- } else if (code.includes(".toBeLessThanOrEqual(")) {
389
- const currentValue = extractArg(code, "toBeLessThanOrEqual");
390
- if (currentValue && receivedValue) {
391
- const actualValue = Number(receivedValue);
392
- if (!isNaN(actualValue)) {
393
- suggestion = code.replace(
394
- `.toBeLessThanOrEqual(${currentValue})`,
395
- `.toBeLessThanOrEqual(${actualValue})`
396
- );
397
- }
398
- }
399
- } else if (code.includes(".toBeLessThan(")) {
400
- const currentValue = extractArg(code, "toBeLessThan");
401
- if (currentValue && receivedValue) {
402
- const actualValue = Number(receivedValue);
403
- if (!isNaN(actualValue)) {
404
- suggestion = code.replace(
405
- `.toBeLessThan(${currentValue})`,
406
- `.toBeLessThan(${actualValue + 1})`
407
- );
408
- }
409
- }
410
- } else if (code.includes(".toStrictEqual(")) {
411
- const expectedValue = extractArg(code, "toStrictEqual");
412
- if (expectedValue && receivedValue) {
413
- const quoted = parseQuotedString(expectedValue);
414
- if (quoted) {
415
- const strippedReceived = stripQuotes(receivedValue);
416
- suggestion = code.replace(
417
- `.toStrictEqual(${expectedValue})`,
418
- `.toStrictEqual(${quoted.quote}${strippedReceived}${quoted.quote})`
419
- );
420
- } else {
421
- suggestion = code.replace(
422
- `.toStrictEqual(${expectedValue})`,
423
- `.toStrictEqual(${receivedValue})`
424
- );
425
- }
426
- }
427
- } else if (code.includes(".toEqual(")) {
428
- const expectedValue = extractArg(code, "toEqual");
429
- if (expectedValue && receivedValue) {
430
- const quoted = parseQuotedString(expectedValue);
431
- if (quoted) {
432
- const strippedReceived = stripQuotes(receivedValue);
433
- suggestion = code.replace(
434
- `.toEqual(${expectedValue})`,
435
- `.toEqual(${quoted.quote}${strippedReceived}${quoted.quote})`
436
- );
437
- } else {
438
- suggestion = code.replace(
439
- `.toEqual(${expectedValue})`,
440
- `.toEqual(${receivedValue})`
441
- );
442
- }
443
- }
444
- } else if (code.includes(".toMatch(")) {
445
- const expectedPattern = extractArg(code, "toMatch");
446
- if (expectedPattern && receivedValue) {
447
- const quoted = parseQuotedString(expectedPattern);
448
- if (quoted) {
449
- const strippedReceived = stripQuotes(receivedValue);
450
- suggestion = code.replace(
451
- `.toMatch(${expectedPattern})`,
452
- `.toMatch(${quoted.quote}${strippedReceived}${quoted.quote})`
453
- );
454
- }
455
- }
456
- } else if (code.includes(".toContain(")) {
457
- const expectedValue = extractArg(code, "toContain");
458
- if (expectedValue && receivedValue) {
459
- const quoted = parseQuotedString(expectedValue);
460
- if (quoted) {
461
- const strippedReceived = stripQuotes(receivedValue);
462
- suggestion = code.replace(
463
- `.toContain(${expectedValue})`,
464
- `.toContain(${quoted.quote}${strippedReceived}${quoted.quote})`
465
- );
466
- } else {
467
- suggestion = code.replace(
468
- `.toContain(${expectedValue})`,
469
- `.toContain(${receivedValue})`
470
- );
471
- }
472
- }
473
- } else if (code.includes(".toHaveLength(")) {
474
- const expectedLength = extractArg(code, "toHaveLength");
475
- if (expectedLength && receivedValue) {
476
- const actualLength = Number(receivedValue);
477
- if (!isNaN(actualLength)) {
478
- suggestion = code.replace(
479
- `.toHaveLength(${expectedLength})`,
480
- `.toHaveLength(${actualLength})`
481
- );
482
- }
483
- }
484
- } else if (code.includes(".toBe(")) {
485
- const expectedValue = extractArg(code, "toBe");
486
- if (expectedValue) {
487
- if (receivedValue) {
488
- const quoted = parseQuotedString(expectedValue);
489
- if (quoted) {
490
- const strippedReceived = stripQuotes(receivedValue);
491
- suggestion = code.replace(
492
- `.toBe(${expectedValue})`,
493
- `.toBe(${quoted.quote}${strippedReceived}${quoted.quote})`
494
- );
495
- } else {
496
- suggestion = code.replace(
497
- `.toBe(${expectedValue})`,
498
- `.toBe(${receivedValue})`
499
- );
500
- }
501
- } else if (expectedValue.includes("'") || expectedValue.includes('"')) {
502
- suggestion = code.replace(".toBe(", ".toEqual(");
503
- }
504
- }
505
- } else if (code.includes(".toBeDefined()")) {
506
- suggestion = code.replace(".toBeDefined()", ".toBeTruthy()");
507
- } else if (code.includes(".toBeNull()")) {
508
- suggestion = code.replace(".toBeNull()", ".toBeUndefined()");
509
- } else if (code.includes(".toBeUndefined()")) {
510
- suggestion = code.replace(".toBeUndefined()", ".toBeNull()");
511
- } else if (code.includes(".toBeTruthy()")) {
512
- suggestion = code.replace(".toBeTruthy()", ".toBeDefined()");
513
- } else if (code.includes(".toBeFalsy()")) {
514
- suggestion = code.replace(".toBeFalsy()", ".toBeUndefined()");
515
- }
516
- console.log(` ${this.c("dim", "Code:")}`);
517
- console.log(` ${this.c("dim", code)}`);
518
- if (suggestion && suggestion !== code) {
519
- console.log(` ${this.c("yellow", "example \u2192")} ${this.c("green", suggestion)}`);
520
- }
502
+ if (!result.error) {
503
+ return;
504
+ }
505
+ if (result.file) {
506
+ const relativePath2 = relative(process.cwd(), result.file).split("\\").join("/");
507
+ const lineSuffix = result.lineNumber ? `:${result.lineNumber}` : "";
508
+ console.log(` ${this.c("cyan", `\u{1F4C4} ${relativePath2}${lineSuffix}`)}`);
509
+ }
510
+ for (const line of result.error.message.split("\n")) {
511
+ if (line.includes("Expected:")) {
512
+ console.log(` ${this.c("green", "Expected:")} ${line.trim().replace("Expected:", "").trim()}`);
513
+ } else if (line.includes("Received:")) {
514
+ console.log(` ${this.c("red", "Received:")} ${line.trim().replace("Received:", "").trim()}`);
515
+ } else {
516
+ console.log(` ${this.c("red", line.trim())}`);
521
517
  }
522
- if (this.options.verbose && result.error.stack) {
523
- const stack = result.error.stack.split("\n").slice(1, 3).join("\n");
524
- console.log(` ${this.c("dim", stack)}`);
518
+ }
519
+ if (result.codeSnippet) {
520
+ const suggestion = buildSuggestion(result.codeSnippet, result.error.message || "");
521
+ console.log(` ${this.c("dim", "Code:")}`);
522
+ console.log(` ${this.c("dim", result.codeSnippet)}`);
523
+ if (suggestion && suggestion !== result.codeSnippet) {
524
+ console.log(` ${this.c("yellow", "example \u2192")} ${this.c("green", suggestion)}`);
525
525
  }
526
526
  }
527
- } else if (result.status === "skip") {
527
+ if (this.options.verbose && result.error.stack) {
528
+ const stack = result.error.stack.split("\n").slice(1, 3).join("\n");
529
+ console.log(` ${this.c("dim", stack)}`);
530
+ }
531
+ return;
532
+ }
533
+ if (result.status === "skip") {
528
534
  console.log(` ${this.c("yellow", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("yellow", "(skipped)")}`);
529
- } else if (result.status === "todo") {
530
- console.log(` ${this.c("cyan", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("cyan", "(todo)")}`);
535
+ return;
531
536
  }
537
+ console.log(` ${this.c("cyan", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("cyan", "(todo)")}`);
532
538
  }
533
539
  onRunEnd(results) {
534
540
  const duration = Date.now() - this.startTime;
535
- const passed = results.filter((r) => r.status === "pass").length;
536
- const failed = results.filter((r) => r.status === "fail").length;
537
- const skipped = results.filter((r) => r.status === "skip").length;
541
+ const passed = results.filter((result) => result.status === "pass").length;
542
+ const failed = results.filter((result) => result.status === "fail").length;
543
+ const skipped = results.filter((result) => result.status === "skip").length;
538
544
  const total = results.length;
539
545
  if (this.currentFile && this.fileTestCount > 0) {
540
546
  console.log("");
@@ -548,6 +554,8 @@ ${this.c("bold", "Test Files")}: ${files.length}`);
548
554
  console.log("");
549
555
  }
550
556
  };
557
+
558
+ // src/test/reporter/dot-reporter.ts
551
559
  var DotReporter = class {
552
560
  constructor() {
553
561
  this.passed = 0;
@@ -581,9 +589,11 @@ var DotReporter = class {
581
589
  `);
582
590
  }
583
591
  c(color, text) {
584
- return colors[color] + text + colors.reset;
592
+ return colorize(color, text);
585
593
  }
586
594
  };
595
+
596
+ // src/test/reporter/json-reporter.ts
587
597
  var JsonReporter = class {
588
598
  constructor() {
589
599
  this.startTime = 0;
@@ -596,30 +606,32 @@ var JsonReporter = class {
596
606
  onTestResult(result) {
597
607
  this.results.push(result);
598
608
  }
599
- onRunEnd(results) {
609
+ onRunEnd(_results) {
600
610
  const report = {
601
611
  summary: {
602
- total: results.length,
603
- passed: results.filter((r) => r.status === "pass").length,
604
- failed: results.filter((r) => r.status === "fail").length,
605
- skipped: results.filter((r) => r.status === "skip").length,
606
- todo: results.filter((r) => r.status === "todo").length,
612
+ total: this.results.length,
613
+ passed: this.results.filter((result) => result.status === "pass").length,
614
+ failed: this.results.filter((result) => result.status === "fail").length,
615
+ skipped: this.results.filter((result) => result.status === "skip").length,
616
+ todo: this.results.filter((result) => result.status === "todo").length,
607
617
  duration: Date.now() - this.startTime
608
618
  },
609
- tests: results.map((r) => ({
610
- status: r.status === "pass" ? "passed" : r.status === "fail" ? "failed" : r.status === "skip" ? "skipped" : "todo",
611
- name: r.name,
612
- suite: r.suite,
613
- duration: r.duration,
614
- error: r.error ? {
615
- message: r.error.message,
616
- stack: r.error.stack
619
+ tests: this.results.map((result) => ({
620
+ status: result.status === "pass" ? "passed" : result.status === "fail" ? "failed" : result.status === "skip" ? "skipped" : "todo",
621
+ name: result.name,
622
+ suite: result.suite,
623
+ duration: result.duration,
624
+ error: result.error ? {
625
+ message: result.error.message,
626
+ stack: result.error.stack
617
627
  } : void 0
618
628
  }))
619
629
  };
620
630
  console.log(JSON.stringify(report, null, 2));
621
631
  }
622
632
  };
633
+
634
+ // src/test/reporter/verbose-reporter.ts
623
635
  var VerboseReporter = class {
624
636
  constructor() {
625
637
  this.currentSuite = "";
@@ -647,9 +659,9 @@ ${colors.red} ${result.error.message}${colors.reset}`);
647
659
  }
648
660
  }
649
661
  onRunEnd(results) {
650
- const passed = results.filter((r) => r.status === "pass").length;
651
- const failed = results.filter((r) => r.status === "fail").length;
652
- const skipped = results.filter((r) => r.status === "skip").length;
662
+ const passed = results.filter((result) => result.status === "pass").length;
663
+ const failed = results.filter((result) => result.status === "fail").length;
664
+ const skipped = results.filter((result) => result.status === "skip").length;
653
665
  console.log(`
654
666
  ${colors.dim}${"\u2500".repeat(50)}${colors.reset}
655
667
  `);
@@ -657,18 +669,22 @@ ${colors.dim}${"\u2500".repeat(50)}${colors.reset}
657
669
  console.log(`${colors.green}All tests passed!${colors.reset}`);
658
670
  console.log(`${colors.dim}${passed} tests${colors.reset}
659
671
  `);
660
- } else {
661
- console.log(`${colors.red}${failed} tests failed${colors.reset}`);
662
- console.log(`${colors.green}${passed} tests passed${colors.reset}`);
663
- if (skipped > 0) {
664
- console.log(`${colors.yellow}${skipped} tests skipped${colors.reset}`);
665
- }
666
- console.log("");
672
+ return;
673
+ }
674
+ console.log(`${colors.red}${failed} tests failed${colors.reset}`);
675
+ console.log(`${colors.green}${passed} tests passed${colors.reset}`);
676
+ if (skipped > 0) {
677
+ console.log(`${colors.yellow}${skipped} tests skipped${colors.reset}`);
667
678
  }
679
+ console.log("");
668
680
  }
669
681
  };
682
+
683
+ // src/test/reporter/utilities.ts
670
684
  function formatErrorStack(error) {
671
- if (!error.stack) return error.message;
685
+ if (!error.stack) {
686
+ return error.message;
687
+ }
672
688
  const lines = error.stack.split("\n");
673
689
  let formatted = `${error.message}
674
690
  `;