@depup/vitest 4.1.0-depup.1 → 4.1.2-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +4 -4
  2. package/changes.json +26 -0
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +3 -3
  5. package/dist/chunks/{base.DM0-RqVb.js → base.BPik1OqN.js} +8 -8
  6. package/dist/chunks/{benchmark.D0SlKNbZ.js → benchmark.CX_oY03V.js} +1 -1
  7. package/dist/chunks/{browser.d.X3SXoOCV.d.ts → browser.d.BMOr_Kmk.d.ts} +1 -1
  8. package/dist/chunks/{cac.CWGDZnXT.js → cac.DRKYQDPl.js} +22 -10
  9. package/dist/chunks/{cli-api.DuT9iuvY.js → cli-api.Bxr1Nn49.js} +154 -40
  10. package/dist/chunks/{config.d.EJLVE3es.d.ts → config.d.Cz9kPrQs.d.ts} +1 -0
  11. package/dist/chunks/{coverage.D_JHT54q.js → coverage.CTzCuANN.js} +4 -1
  12. package/dist/chunks/{coverage.Bri33R1t.js → coverage.kqM80boz.js} +26 -11
  13. package/dist/chunks/{defaults.CdU2lD-q.js → defaults.9aQKnqFk.js} +13 -5
  14. package/dist/chunks/{globals.BXNGLnTL.js → globals.CVqIbOyt.js} +3 -3
  15. package/dist/chunks/{index.DXMFO5MJ.js → index.0GYC6HAu.js} +627 -586
  16. package/dist/chunks/{index.EY6TCHpo.js → index.DC7d2Pf8.js} +2 -2
  17. package/dist/chunks/{index.DlDSLQD3.js → index.DOa3dzoN.js} +2 -2
  18. package/dist/chunks/{index.DGNSnENe.js → index.nZ2xqFgD.js} +2 -2
  19. package/dist/chunks/{init-forks.DeArv0jT.js → init-forks.UV3ZQGQH.js} +1 -1
  20. package/dist/chunks/{init-threads.-2OUl4Nn.js → init-threads.D3eCsY76.js} +1 -1
  21. package/dist/chunks/{init.DICorXCo.js → init.D98-gwRW.js} +5 -3
  22. package/dist/chunks/{nativeModuleMocker.DndvSdL6.js → nativeModuleMocker.BRN2oBJd.js} +2 -2
  23. package/dist/chunks/{plugin.d.BuW-flqo.d.ts → plugin.d.BWbK_Jpw.d.ts} +1 -1
  24. package/dist/chunks/{reporters.d.DVUYHHhe.d.ts → reporters.d.B0uk8id2.d.ts} +54 -33
  25. package/dist/chunks/{setup-common.B41N_kPE.js → setup-common.2wZXQUjS.js} +2 -2
  26. package/dist/chunks/{startVitestModuleRunner.C3ZR-4J3.js → startVitestModuleRunner.bRl2_oI_.js} +19 -5
  27. package/dist/chunks/{test.CTcmp4Su.js → test.p_J6dB8a.js} +3 -2
  28. package/dist/chunks/{traces.CCmnQaNT.js → traces.DT5aQ62U.js} +1 -1
  29. package/dist/chunks/utils.DK8FXp4T.js +189 -0
  30. package/dist/chunks/{vm.Dh2rTtmP.js → vm.BvVhnZPV.js} +2 -2
  31. package/dist/chunks/{worker.d.B84sVRy0.d.ts → worker.d.BT5j8dyR.d.ts} +1 -1
  32. package/dist/cli.js +2 -20
  33. package/dist/config.cjs +13 -5
  34. package/dist/config.d.ts +8 -8
  35. package/dist/config.js +1 -1
  36. package/dist/coverage.d.ts +7 -7
  37. package/dist/coverage.js +3 -3
  38. package/dist/environments.js +1 -1
  39. package/dist/index.d.ts +7 -6
  40. package/dist/index.js +3 -3
  41. package/dist/module-evaluator.js +2 -2
  42. package/dist/node.d.ts +7 -7
  43. package/dist/node.js +11 -11
  44. package/dist/reporters.d.ts +4 -4
  45. package/dist/reporters.js +6 -6
  46. package/dist/runners.d.ts +3 -2
  47. package/dist/runners.js +2 -2
  48. package/dist/runtime.js +3 -3
  49. package/dist/suite.js +1 -1
  50. package/dist/worker.d.ts +2 -2
  51. package/dist/worker.js +12 -11
  52. package/dist/workers/forks.js +13 -12
  53. package/dist/workers/runVmTests.js +6 -6
  54. package/dist/workers/threads.js +13 -12
  55. package/dist/workers/vmForks.js +7 -7
  56. package/dist/workers/vmThreads.js +7 -7
  57. package/optional-runtime-types.d.ts +6 -0
  58. package/package.json +36 -29
  59. package/dist/chunks/git.Bm2pzPAa.js +0 -71
  60. package/dist/chunks/index.CEzQDJGb.js +0 -231
@@ -3,11 +3,11 @@ import module$1 from 'node:module';
3
3
  import path from 'node:path';
4
4
  import { pathToFileURL, fileURLToPath } from 'node:url';
5
5
  import { slash, shuffle, toArray, cleanUrl } from '@vitest/utils/helpers';
6
- import { resolve, relative, normalize } from 'pathe';
6
+ import { resolve, relative, normalize, join } from 'pathe';
7
7
  import pm from 'picomatch';
8
8
  import { glob } from 'tinyglobby';
9
9
  import c from 'tinyrainbow';
10
- import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.CdU2lD-q.js';
10
+ import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.9aQKnqFk.js';
11
11
  import crypto from 'node:crypto';
12
12
  import { r as resolveModule } from './index.BCY_7LL2.js';
13
13
  import { mergeConfig } from 'vite';
@@ -15,7 +15,7 @@ import { c as configFiles, d as defaultBrowserPort, a as defaultInspectPort, b a
15
15
  import './env.D4Lgay0q.js';
16
16
  import nodeos__default from 'node:os';
17
17
  import { isCI, isAgent, provider } from 'std-env';
18
- import { r as resolveCoverageProviderModule } from './coverage.D_JHT54q.js';
18
+ import { r as resolveCoverageProviderModule } from './coverage.CTzCuANN.js';
19
19
 
20
20
  const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
21
21
 
@@ -30,7 +30,7 @@ class BaseSequencer {
30
30
  constructor(ctx) {
31
31
  this.ctx = ctx;
32
32
  }
33
- // async so it can be extended by other sequelizers
33
+ // async so it can be extended by other sequencers
34
34
  async shard(files) {
35
35
  const { config } = this.ctx;
36
36
  const { index, count } = config.shard;
@@ -43,7 +43,7 @@ class BaseSequencer {
43
43
  };
44
44
  }).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ spec }) => spec);
45
45
  }
46
- // async so it can be extended by other sequelizers
46
+ // async so it can be extended by other sequencers
47
47
  async sort(files) {
48
48
  const cache = this.ctx.cache;
49
49
  return [...files].sort((a, b) => {
@@ -95,7 +95,16 @@ class RandomSequencer extends BaseSequencer {
95
95
  }
96
96
 
97
97
  function resolvePath(path, root) {
98
- return normalize(/* @__PURE__ */ resolveModule(path, { paths: [root] }) ?? resolve(root, path));
98
+ // local-pkg (mlly)'s resolveModule("./file", { paths: ["/some/root"] }) tries
99
+ // /some/file
100
+ // /some/file.js
101
+ // /some/root/file
102
+ // /some/root/file.js
103
+ // etc.
104
+ // but we don't want to resolve files from parent directories,
105
+ // so we ensure passing "/" suffix such as "/some/root/"
106
+ // https://github.com/unjs/mlly/blob/401d42983f6f3a9112658d67b0a92ba4fb1d7efa/src/resolve.ts#L104-L110
107
+ return normalize(/* @__PURE__ */ resolveModule(path, { paths: [join(root, "/")] }) ?? resolve(root, path));
99
108
  }
100
109
  function parseInspector(inspect) {
101
110
  if (typeof inspect === "boolean" || inspect === void 0) return {};
@@ -317,7 +326,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
317
326
  resolved.deps.web.transformGlobPattern ??= [];
318
327
  resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root));
319
328
  resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root));
320
- // Add hard-coded default coverage exclusions. These cannot be overidden by user config.
329
+ // Add hard-coded default coverage exclusions. These cannot be overridden by user config.
321
330
  // Override original exclude array for cases where user re-uses same object in test.exclude.
322
331
  resolved.coverage.exclude = [
323
332
  ...resolved.coverage.exclude,
@@ -534,6 +543,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
534
543
  resolved.experimental.importDurations.thresholds ??= {};
535
544
  resolved.experimental.importDurations.thresholds.warn ??= 100;
536
545
  resolved.experimental.importDurations.thresholds.danger ??= 500;
546
+ if (typeof resolved.experimental.vcsProvider === "string" && resolved.experimental.vcsProvider !== "git") resolved.experimental.vcsProvider = resolvePath(resolved.experimental.vcsProvider, resolved.root);
537
547
  return resolved;
538
548
  }
539
549
  function isBrowserEnabled(config) {
@@ -744,10 +754,15 @@ Update your dependencies and make sure the versions match.`));
744
754
  if (readdirSync(this.options.reportsDirectory).length === 0) await promises.rm(this.options.reportsDirectory, { recursive: true });
745
755
  }
746
756
  async onTestRunStart() {
747
- if (this.options.changed) {
748
- const { VitestGit } = await import('./git.Bm2pzPAa.js');
749
- this.changedFiles = await new VitestGit(this.ctx.config.root).findChangedFiles({ changedSince: this.options.changed }) ?? void 0;
750
- } else if (this.ctx.config.changed) this.changedFiles = this.ctx.config.related;
757
+ if (this.options.changed) try {
758
+ this.changedFiles = await this.ctx.vcs.findChangedFiles({
759
+ root: this.ctx.config.root,
760
+ changedSince: this.options.changed
761
+ });
762
+ } catch {
763
+ this.changedFiles = void 0;
764
+ }
765
+ else if (this.ctx.config.changed) this.changedFiles = this.ctx.config.related;
751
766
  if (this.changedFiles) this.globCache.clear();
752
767
  }
753
768
  async onTestFailure() {
@@ -21,14 +21,22 @@ const coverageConfigDefaults = {
21
21
  exclude: [],
22
22
  reportOnFailure: false,
23
23
  reporter: [
24
- ["text", {}],
25
- ["html", {}],
26
- ["clover", {}],
27
- ["json", {}]
24
+ "text",
25
+ "html",
26
+ "clover",
27
+ "json"
28
28
  ],
29
29
  allowExternal: false,
30
30
  excludeAfterRemap: false,
31
- processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
31
+ processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length),
32
+ ignoreClassMethods: [],
33
+ skipFull: false,
34
+ watermarks: {
35
+ statements: [50, 80],
36
+ functions: [50, 80],
37
+ branches: [50, 80],
38
+ lines: [50, 80]
39
+ }
32
40
  };
33
41
  const fakeTimersDefaults = {
34
42
  loopLimit: 1e4,
@@ -1,10 +1,10 @@
1
1
  import { g as globalApis } from './constants.CPYnjOGj.js';
2
- import { i as index } from './index.DlDSLQD3.js';
3
- import './test.CTcmp4Su.js';
2
+ import { i as index } from './index.DOa3dzoN.js';
3
+ import './test.p_J6dB8a.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/utils/helpers';
6
6
  import '@vitest/utils/timers';
7
- import './benchmark.D0SlKNbZ.js';
7
+ import './benchmark.CX_oY03V.js';
8
8
  import '@vitest/runner/utils';
9
9
  import './utils.BX5Fg8C4.js';
10
10
  import '@vitest/expect';