vitest 2.1.5 → 2.2.0-beta.2

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 (45) hide show
  1. package/LICENSE.md +0 -75
  2. package/dist/browser.d.ts +11 -11
  3. package/dist/browser.js +1 -1
  4. package/dist/chunks/{RandomSequencer.CMRlh2v4.js → RandomSequencer.BPedXEug.js} +1 -0
  5. package/dist/chunks/{base.BZZh4cSm.js → base.BS0HhLXd.js} +1 -1
  6. package/dist/chunks/{benchmark.geERunq4.d.ts → benchmark.CFFwLv-O.d.ts} +2 -2
  7. package/dist/chunks/{cac.DWAW3Uh5.js → cac.Cs06pOqp.js} +56 -7
  8. package/dist/chunks/{cli-api.BtqJwSCh.js → cli-api.CB-jIbYQ.js} +585 -407
  9. package/dist/chunks/{config.Cy0C388Z.d.ts → config.CPguQ7J1.d.ts} +2 -1
  10. package/dist/chunks/{environment.LoooBwUu.d.ts → environment.CT0jpO-1.d.ts} +2 -1
  11. package/dist/chunks/{globals.D8ZVAdXd.js → globals.BCGEw6ON.js} +2 -2
  12. package/dist/chunks/{index.nEwtF0bu.js → index.BjjsHdBb.js} +1 -1
  13. package/dist/chunks/{index.ckWaX2gY.js → index.DD5eTY2y.js} +2 -8
  14. package/dist/chunks/{index.DsZFoqi9.js → index.bzFpKeaq.js} +601 -807
  15. package/dist/chunks/{reporters.D7Jzd9GS.d.ts → reporters.F9D2idOT.d.ts} +1429 -1286
  16. package/dist/chunks/{resolveConfig.RxKrDli4.js → resolveConfig.CLnvCvEs.js} +11 -9
  17. package/dist/chunks/{runBaseTests.3qpJUEJM.js → runBaseTests.B7hcVT-s.js} +4 -4
  18. package/dist/chunks/{setup-common.Dj6BZI3u.js → setup-common.BfGt8K-K.js} +4 -1
  19. package/dist/chunks/{suite.B2jumIFP.d.ts → suite.BJU7kdY9.d.ts} +4 -4
  20. package/dist/chunks/{utils.DNoFbBUZ.js → utils.DJONn5B5.js} +15 -21
  21. package/dist/chunks/{vi.DgezovHB.js → vi.BlPttogV.js} +6 -1
  22. package/dist/chunks/{vite.C-N5BBZe.d.ts → vite.DonA4fvH.d.ts} +1 -1
  23. package/dist/chunks/{worker.tN5KGIih.d.ts → worker.9VY11NZs.d.ts} +2 -2
  24. package/dist/chunks/{worker.B9FxPCaC.d.ts → worker.Qz1UB4Fv.d.ts} +1 -1
  25. package/dist/cli.js +1 -1
  26. package/dist/config.d.ts +13 -11
  27. package/dist/coverage.d.ts +9 -112
  28. package/dist/coverage.js +2 -2
  29. package/dist/environments.d.ts +2 -2
  30. package/dist/execute.d.ts +4 -3
  31. package/dist/index.d.ts +14 -13
  32. package/dist/index.js +2 -2
  33. package/dist/node.d.ts +26 -15
  34. package/dist/node.js +9 -9
  35. package/dist/reporters.d.ts +9 -8
  36. package/dist/reporters.js +4 -5
  37. package/dist/runners.d.ts +5 -3
  38. package/dist/runners.js +4 -1
  39. package/dist/suite.d.ts +2 -2
  40. package/dist/workers/forks.js +1 -1
  41. package/dist/workers/runVmTests.js +4 -4
  42. package/dist/workers/threads.js +1 -1
  43. package/dist/workers.d.ts +5 -4
  44. package/dist/workers.js +1 -1
  45. package/package.json +13 -12
package/LICENSE.md CHANGED
@@ -931,23 +931,6 @@ Repository: micromatch/micromatch
931
931
 
932
932
  ---------------------------------------
933
933
 
934
- ## mimic-fn
935
- License: MIT
936
- By: Sindre Sorhus
937
- Repository: sindresorhus/mimic-fn
938
-
939
- > MIT License
940
- >
941
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
942
- >
943
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
944
- >
945
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
946
- >
947
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
948
-
949
- ---------------------------------------
950
-
951
934
  ## mlly
952
935
  License: MIT
953
936
  Repository: unjs/mlly
@@ -976,23 +959,6 @@ Repository: unjs/mlly
976
959
 
977
960
  ---------------------------------------
978
961
 
979
- ## onetime
980
- License: MIT
981
- By: Sindre Sorhus
982
- Repository: sindresorhus/onetime
983
-
984
- > MIT License
985
- >
986
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
987
- >
988
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
989
- >
990
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
991
- >
992
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
993
-
994
- ---------------------------------------
995
-
996
962
  ## p-limit
997
963
  License: MIT
998
964
  By: Sindre Sorhus
@@ -1171,23 +1137,6 @@ Repository: privatenumber/resolve-pkg-maps
1171
1137
 
1172
1138
  ---------------------------------------
1173
1139
 
1174
- ## restore-cursor
1175
- License: MIT
1176
- By: Sindre Sorhus
1177
- Repository: sindresorhus/restore-cursor
1178
-
1179
- > MIT License
1180
- >
1181
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1182
- >
1183
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1184
- >
1185
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1186
- >
1187
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1188
-
1189
- ---------------------------------------
1190
-
1191
1140
  ## reusify
1192
1141
  License: MIT
1193
1142
  By: Matteo Collina
@@ -1245,30 +1194,6 @@ Repository: git://github.com/feross/run-parallel.git
1245
1194
 
1246
1195
  ---------------------------------------
1247
1196
 
1248
- ## signal-exit
1249
- License: ISC
1250
- By: Ben Coe
1251
- Repository: https://github.com/tapjs/signal-exit.git
1252
-
1253
- > The ISC License
1254
- >
1255
- > Copyright (c) 2015, Contributors
1256
- >
1257
- > Permission to use, copy, modify, and/or distribute this software
1258
- > for any purpose with or without fee is hereby granted, provided
1259
- > that the above copyright notice and this permission notice
1260
- > appear in all copies.
1261
- >
1262
- > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1263
- > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
1264
- > OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
1265
- > LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
1266
- > OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1267
- > WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1268
- > ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1269
-
1270
- ---------------------------------------
1271
-
1272
1197
  ## sisteransi
1273
1198
  License: MIT
1274
1199
  By: Terkel Gjervig
package/dist/browser.d.ts CHANGED
@@ -1,27 +1,27 @@
1
- import { C as CoverageProvider, b as CoverageProviderModule } from './chunks/reporters.D7Jzd9GS.js';
2
- import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.Cy0C388Z.js';
1
+ import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.F9D2idOT.js';
2
+ import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.CPguQ7J1.js';
3
3
  import * as spy$1 from '@vitest/spy';
4
- import { DiffOptions } from '@vitest/expect';
4
+ import * as _vitest_utils_diff from '@vitest/utils/diff';
5
5
  import { VitestExecutor } from './execute.js';
6
6
  export { collectTests, processError, startTests } from '@vitest/runner';
7
- import './chunks/environment.LoooBwUu.js';
7
+ import './chunks/environment.CT0jpO-1.js';
8
8
  import 'node:stream';
9
9
  import 'vite';
10
10
  import '@vitest/utils';
11
+ import 'vite-node';
12
+ import '@vitest/utils/source-map';
11
13
  import '@vitest/pretty-format';
12
14
  import '@vitest/snapshot';
13
- import 'vite-node';
14
15
  import 'chai';
15
- import '@vitest/utils/source-map';
16
- import 'vite-node/client';
17
- import 'vite-node/server';
18
- import './chunks/benchmark.geERunq4.js';
16
+ import './chunks/benchmark.CFFwLv-O.js';
19
17
  import '@vitest/runner/utils';
20
18
  import 'tinybench';
19
+ import 'vite-node/client';
20
+ import 'vite-node/server';
21
21
  import '@vitest/snapshot/manager';
22
22
  import 'node:fs';
23
23
  import '@vitest/snapshot/environment';
24
- import './chunks/worker.tN5KGIih.js';
24
+ import './chunks/worker.9VY11NZs.js';
25
25
  import 'node:vm';
26
26
  import '@vitest/mocker';
27
27
  import './chunks/mocker.cRtM890J.js';
@@ -57,7 +57,7 @@ declare function takeCoverageInsideWorker(options: SerializedCoverageConfig | un
57
57
  declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: Loader): Promise<unknown>;
58
58
 
59
59
  declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
60
- declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<DiffOptions | undefined>;
60
+ declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<_vitest_utils_diff.SerializedDiffOptions | undefined>;
61
61
  declare function loadSnapshotSerializers(config: SerializedConfig, executor: VitestExecutor): Promise<void>;
62
62
 
63
63
  export { spy as SpyModule, getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BoMDb1ip.js';
2
2
  export { s as SpyModule } from './chunks/spy.Cf_4R5Oe.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.Dj6BZI3u.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.BfGt8K-K.js';
4
4
  export { collectTests, processError, startTests } from '@vitest/runner';
5
5
  import '@vitest/spy';
6
6
  import '@vitest/snapshot';
@@ -329,6 +329,7 @@ async function collectTests(ctx, filepath) {
329
329
  if (!request) {
330
330
  return null;
331
331
  }
332
+ request.code = request.code.replace(/__vite_ssr_identity__\((\w+\.\w+)\)/g, "( $1)");
332
333
  const ast = await parseAstAsync(request.code);
333
334
  const testFilepath = relative(ctx.config.root, filepath);
334
335
  const projectName = ctx.getName();
@@ -24,7 +24,7 @@ async function runBaseTests(method, state) {
24
24
  ctx.files.forEach((i) => state.moduleCache.delete(i));
25
25
  const [executor, { run }] = await Promise.all([
26
26
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
27
- import('./runBaseTests.3qpJUEJM.js')
27
+ import('./runBaseTests.B7hcVT-s.js')
28
28
  ]);
29
29
  await run(
30
30
  method,
@@ -1,8 +1,8 @@
1
- import { Custom } from '@vitest/runner';
1
+ import { Test } from '@vitest/runner';
2
2
  import { ChainableFunction } from '@vitest/runner/utils';
3
3
  import { TaskResult, Bench, Options } from 'tinybench';
4
4
 
5
- interface Benchmark extends Custom {
5
+ interface Benchmark extends Test {
6
6
  meta: {
7
7
  benchmark: true;
8
8
  result?: TaskResult;
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "2.1.5";
621
+ var version = "2.2.0-beta.2";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -1121,9 +1121,58 @@ const cliOptionsConfig = {
1121
1121
  argument: "<times>"
1122
1122
  },
1123
1123
  diff: {
1124
- description: "Path to a diff config that will be used to generate diff interface",
1124
+ description: "DiffOptions object or a path to a module which exports DiffOptions object",
1125
1125
  argument: "<path>",
1126
- normalize: true
1126
+ subcommands: {
1127
+ aAnnotation: {
1128
+ description: "Annotation for expected lines (default: `Expected`)",
1129
+ argument: "<annotation>"
1130
+ },
1131
+ aIndicator: {
1132
+ description: "Indicator for expected lines (default: `-`)",
1133
+ argument: "<indicator>"
1134
+ },
1135
+ bAnnotation: {
1136
+ description: "Annotation for received lines (default: `Received`)",
1137
+ argument: "<annotation>"
1138
+ },
1139
+ bIndicator: {
1140
+ description: "Indicator for received lines (default: `+`)",
1141
+ argument: "<indicator>"
1142
+ },
1143
+ commonIndicator: {
1144
+ description: "Indicator for common lines (default: ` `)",
1145
+ argument: "<indicator>"
1146
+ },
1147
+ contextLines: {
1148
+ description: "Number of lines of context to show around each change (default: `5`)",
1149
+ argument: "<lines>"
1150
+ },
1151
+ emptyFirstOrLastLinePlaceholder: {
1152
+ description: 'Placeholder for an empty first or last line (default: `""`)',
1153
+ argument: "<placeholder>"
1154
+ },
1155
+ expand: {
1156
+ description: "Expand all common lines (default: `true`)"
1157
+ },
1158
+ includeChangeCounts: {
1159
+ description: "Include comparison counts in diff output (default: `false`)"
1160
+ },
1161
+ omitAnnotationLines: {
1162
+ description: "Omit annotation lines from the output (default: `false`)"
1163
+ },
1164
+ printBasicPrototype: {
1165
+ description: "Print basic prototype Object and Array (default: `true`)"
1166
+ },
1167
+ truncateThreshold: {
1168
+ description: "Number of lines to show before and after each change (default: `0`)",
1169
+ argument: "<threshold>"
1170
+ },
1171
+ truncateAnnotation: {
1172
+ description: "Annotation for truncated lines (default: `... Diff result is truncated`)",
1173
+ argument: "<annotation>"
1174
+ }
1175
+ }
1127
1176
  },
1128
1177
  exclude: {
1129
1178
  description: "Additional file globs to be excluded from test",
@@ -1502,13 +1551,13 @@ async function start(mode, cliFilters, options) {
1502
1551
  } catch {
1503
1552
  }
1504
1553
  try {
1505
- const { startVitest } = await import('./cli-api.BtqJwSCh.js').then(function (n) { return n.e; });
1554
+ const { startVitest } = await import('./cli-api.CB-jIbYQ.js').then(function (n) { return n.e; });
1506
1555
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
1507
1556
  if (!ctx?.shouldKeepServer()) {
1508
1557
  await ctx?.exit();
1509
1558
  }
1510
1559
  } catch (e) {
1511
- const { divider } = await import('./utils.DNoFbBUZ.js').then(function (n) { return n.u; });
1560
+ const { divider } = await import('./utils.DJONn5B5.js').then(function (n) { return n.u; });
1512
1561
  console.error(`
1513
1562
  ${c.red(divider(c.bold(c.inverse(" Startup Error "))))}`);
1514
1563
  console.error(e);
@@ -1533,7 +1582,7 @@ async function collect(mode, cliFilters, options) {
1533
1582
  } catch {
1534
1583
  }
1535
1584
  try {
1536
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BtqJwSCh.js').then(function (n) { return n.e; });
1585
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CB-jIbYQ.js').then(function (n) { return n.e; });
1537
1586
  const ctx = await prepareVitest(mode, {
1538
1587
  ...normalizeCliOptions(options),
1539
1588
  watch: false,
@@ -1555,7 +1604,7 @@ async function collect(mode, cliFilters, options) {
1555
1604
  }
1556
1605
  await ctx.close();
1557
1606
  } catch (e) {
1558
- const { divider } = await import('./utils.DNoFbBUZ.js').then(function (n) { return n.u; });
1607
+ const { divider } = await import('./utils.DJONn5B5.js').then(function (n) { return n.u; });
1559
1608
  console.error(`
1560
1609
  ${c.red(divider(c.bold(c.inverse(" Collect Error "))))}`);
1561
1610
  console.error(e);