vitest 0.14.2 → 0.15.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.
@@ -1,23 +1,24 @@
1
- import { j as join, k as basename, d as dirname, l as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, m as isAbsolute, o as relative, q as isNode, u as getTests, v as getFullName, x as hasFailed, y as hasFailedSnapshot, z as getSuites, B as safeSetInterval, C as safeClearInterval, e as safeSetTimeout, t as toArray$1, D as normalize, n as noop$1, f as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, h as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.2684ee9f.mjs';
1
+ import { j as join, l as basename, d as dirname, m as resolve, s as slash$2, A as AggregateErrorPonyfill, p as picocolors, o as isAbsolute, q as relative, t as isNode, u as getTests, e as getFullName, v as hasFailed, x as hasFailedSnapshot, y as getSuites, z as safeSetInterval, B as safeClearInterval, f as safeSetTimeout, C as toArray$1, D as normalize, n as noop$1, h as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, k as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.79a8b1cc.mjs';
2
2
  import { createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'path';
4
4
  import url, { fileURLToPath, pathToFileURL } from 'url';
5
5
  import process$1 from 'process';
6
6
  import fs$8, { promises, existsSync, readFileSync } from 'fs';
7
- import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.da1921b9.mjs';
7
+ import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.dc6dc23d.mjs';
8
+ import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.7b9cfc82.mjs';
8
9
  import readline from 'readline';
9
10
  import require$$0, { cpus, hostname, constants as constants$5 } from 'os';
10
11
  import require$$0$1 from 'util';
11
12
  import require$$0$2 from 'stream';
12
13
  import require$$2 from 'events';
13
14
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
14
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.b9738a10.mjs';
15
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.1bbdb2c1.mjs';
15
16
  import createDebug from 'debug';
16
- import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.45dc5e3d.mjs';
17
17
  import { MessageChannel } from 'worker_threads';
18
+ import { createHash } from 'crypto';
18
19
  import { Tinypool } from 'tinypool';
19
20
  import { performance } from 'perf_hooks';
20
- import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.790e5c11.mjs';
21
+ import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.2556cba8.mjs';
21
22
  import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.e5dc6622.mjs';
22
23
  import { resolveModule } from 'local-pkg';
23
24
  import { Buffer } from 'buffer';
@@ -25,142 +26,7 @@ import childProcess from 'child_process';
25
26
  import MagicString from './chunk-magic-string.efe26975.mjs';
26
27
  import { p as prompts } from './vendor-index.98e769c1.mjs';
27
28
 
28
- var version = "0.14.2";
29
-
30
- /*
31
- How it works:
32
- `this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
33
- */
34
-
35
- class Node {
36
- value;
37
- next;
38
-
39
- constructor(value) {
40
- this.value = value;
41
- }
42
- }
43
-
44
- class Queue {
45
- #head;
46
- #tail;
47
- #size;
48
-
49
- constructor() {
50
- this.clear();
51
- }
52
-
53
- enqueue(value) {
54
- const node = new Node(value);
55
-
56
- if (this.#head) {
57
- this.#tail.next = node;
58
- this.#tail = node;
59
- } else {
60
- this.#head = node;
61
- this.#tail = node;
62
- }
63
-
64
- this.#size++;
65
- }
66
-
67
- dequeue() {
68
- const current = this.#head;
69
- if (!current) {
70
- return;
71
- }
72
-
73
- this.#head = this.#head.next;
74
- this.#size--;
75
- return current.value;
76
- }
77
-
78
- clear() {
79
- this.#head = undefined;
80
- this.#tail = undefined;
81
- this.#size = 0;
82
- }
83
-
84
- get size() {
85
- return this.#size;
86
- }
87
-
88
- * [Symbol.iterator]() {
89
- let current = this.#head;
90
-
91
- while (current) {
92
- yield current.value;
93
- current = current.next;
94
- }
95
- }
96
- }
97
-
98
- function pLimit(concurrency) {
99
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
100
- throw new TypeError('Expected `concurrency` to be a number from 1 and up');
101
- }
102
-
103
- const queue = new Queue();
104
- let activeCount = 0;
105
-
106
- const next = () => {
107
- activeCount--;
108
-
109
- if (queue.size > 0) {
110
- queue.dequeue()();
111
- }
112
- };
113
-
114
- const run = async (fn, resolve, args) => {
115
- activeCount++;
116
-
117
- const result = (async () => fn(...args))();
118
-
119
- resolve(result);
120
-
121
- try {
122
- await result;
123
- } catch {}
124
-
125
- next();
126
- };
127
-
128
- const enqueue = (fn, resolve, args) => {
129
- queue.enqueue(run.bind(undefined, fn, resolve, args));
130
-
131
- (async () => {
132
- // This function needs to wait until the next microtask before comparing
133
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
134
- // when the run function is dequeued and called. The comparison in the if-statement
135
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
136
- await Promise.resolve();
137
-
138
- if (activeCount < concurrency && queue.size > 0) {
139
- queue.dequeue()();
140
- }
141
- })();
142
- };
143
-
144
- const generator = (fn, ...args) => new Promise(resolve => {
145
- enqueue(fn, resolve, args);
146
- });
147
-
148
- Object.defineProperties(generator, {
149
- activeCount: {
150
- get: () => activeCount,
151
- },
152
- pendingCount: {
153
- get: () => queue.size,
154
- },
155
- clearQueue: {
156
- value: () => {
157
- queue.clear();
158
- },
159
- },
160
- });
161
-
162
- return generator;
163
- }
29
+ var version = "0.15.2";
164
30
 
165
31
  class EndError extends Error {
166
32
  constructor(value) {
@@ -188,7 +54,7 @@ async function pLocate(
188
54
  {
189
55
  concurrency = Number.POSITIVE_INFINITY,
190
56
  preserveOrder = true,
191
- },
57
+ } = {},
192
58
  ) {
193
59
  const limit = pLimit(concurrency);
194
60
 
@@ -255,7 +121,7 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
255
121
 
256
122
  const findUpStop = Symbol('findUpStop');
257
123
 
258
- async function findUpMultiple(name, options) {
124
+ async function findUpMultiple(name, options = {}) {
259
125
  let directory = path$a.resolve(toPath(options.cwd) || '');
260
126
  const {root} = path$a.parse(directory);
261
127
  const stopAt = path$a.resolve(directory, options.stopAt || root);
@@ -299,7 +165,7 @@ async function findUpMultiple(name, options) {
299
165
  return matches;
300
166
  }
301
167
 
302
- async function findUp(name, options) {
168
+ async function findUp(name, options = {}) {
303
169
  const matches = await findUpMultiple(name, {...options, limit: 1});
304
170
  return matches[0];
305
171
  }
@@ -1189,7 +1055,7 @@ const invalidStep = (step, options) => {
1189
1055
  return [];
1190
1056
  };
1191
1057
 
1192
- const fillNumbers = (start, end, step = 1, options) => {
1058
+ const fillNumbers = (start, end, step = 1, options = {}) => {
1193
1059
  let a = Number(start);
1194
1060
  let b = Number(end);
1195
1061
 
@@ -1241,7 +1107,7 @@ const fillNumbers = (start, end, step = 1, options) => {
1241
1107
  return range;
1242
1108
  };
1243
1109
 
1244
- const fillLetters = (start, end, step = 1, options) => {
1110
+ const fillLetters = (start, end, step = 1, options = {}) => {
1245
1111
  if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
1246
1112
  return invalidRange(start, end, options);
1247
1113
  }
@@ -7000,7 +6866,8 @@ class ViteNodeServer {
7000
6866
  async resolveId(id, importer) {
7001
6867
  if (importer && !importer.startsWith(this.server.config.root))
7002
6868
  importer = join(this.server.config.root, importer);
7003
- return this.server.pluginContainer.resolveId(id, importer, { ssr: true });
6869
+ const mode = importer && this.getTransformMode(importer) || "ssr";
6870
+ return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
7004
6871
  }
7005
6872
  async fetchModule(id) {
7006
6873
  if (!this.fetchPromiseMap.has(id)) {
@@ -7151,11 +7018,13 @@ const workerPath = pathToFileURL(resolve(distDir, "./worker.mjs")).href;
7151
7018
  function createPool(ctx) {
7152
7019
  var _a;
7153
7020
  const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
7021
+ const maxThreads = ctx.config.maxThreads ?? threadsCount;
7022
+ const minThreads = ctx.config.minThreads ?? threadsCount;
7154
7023
  const options = {
7155
7024
  filename: workerPath,
7156
7025
  useAtomics: false,
7157
- maxThreads: ctx.config.maxThreads ?? threadsCount,
7158
- minThreads: ctx.config.minThreads ?? threadsCount
7026
+ maxThreads,
7027
+ minThreads
7159
7028
  };
7160
7029
  if (ctx.config.isolate) {
7161
7030
  options.isolateWorkers = true;
@@ -7177,15 +7046,16 @@ function createPool(ctx) {
7177
7046
  const pool = new Tinypool(options);
7178
7047
  const runWithFiles = (name) => {
7179
7048
  let id = 0;
7180
- const config = ctx.getSerializableConfig();
7181
- async function runFiles(files, invalidates = []) {
7049
+ async function runFiles(config, files, invalidates = []) {
7182
7050
  const { workerPort, port } = createChannel(ctx);
7051
+ const workerId = ++id;
7183
7052
  const data = {
7184
7053
  port: workerPort,
7185
7054
  config,
7186
7055
  files,
7187
7056
  invalidates,
7188
- id: ++id
7057
+ workerId,
7058
+ poolId: !ctx.config.threads ? 1 : (workerId - 1) % maxThreads + 1
7189
7059
  };
7190
7060
  try {
7191
7061
  await pool.run(data, { transferList: [workerPort], name });
@@ -7195,10 +7065,25 @@ function createPool(ctx) {
7195
7065
  }
7196
7066
  }
7197
7067
  return async (files, invalidates) => {
7068
+ const config = ctx.getSerializableConfig();
7069
+ if (config.shard) {
7070
+ const { index, count } = config.shard;
7071
+ const shardSize = Math.ceil(files.length / count);
7072
+ const shardStart = shardSize * (index - 1);
7073
+ const shardEnd = shardSize * index;
7074
+ files = files.map((file) => {
7075
+ const fullPath = resolve(slash$2(config.root), slash$2(file));
7076
+ const specPath = fullPath.slice(config.root.length);
7077
+ return {
7078
+ file,
7079
+ hash: createHash("sha1").update(specPath).digest("hex")
7080
+ };
7081
+ }).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ file }) => file);
7082
+ }
7198
7083
  if (!ctx.config.threads) {
7199
- await runFiles(files);
7084
+ await runFiles(config, files);
7200
7085
  } else {
7201
- const results = await Promise.allSettled(files.map((file) => runFiles([file], invalidates)));
7086
+ const results = await Promise.allSettled(files.map((file) => runFiles(config, [file], invalidates)));
7202
7087
  const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
7203
7088
  if (errors.length > 0)
7204
7089
  throw new AggregateErrorPonyfill(errors, "Errors occurred while running tests. For more information, see serialized error.");
@@ -7274,7 +7159,7 @@ const F_DOWN = "\u2193";
7274
7159
  const F_DOWN_RIGHT = "\u21B3";
7275
7160
  const F_POINTER = "\u276F";
7276
7161
  const F_DOT = "\xB7";
7277
- const F_CHECK = "\u221A";
7162
+ const F_CHECK = "\u2713";
7278
7163
  const F_CROSS = "\xD7";
7279
7164
  const F_LONG_DASH = "\u23AF";
7280
7165
 
@@ -8963,7 +8848,7 @@ function resolveApiConfig(options) {
8963
8848
  return api;
8964
8849
  }
8965
8850
  function resolveConfig(options, viteConfig) {
8966
- var _a, _b;
8851
+ var _a, _b, _c;
8967
8852
  if (options.dom) {
8968
8853
  if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
8969
8854
  console.warn(picocolors.exports.yellow(`${picocolors.exports.inverse(picocolors.exports.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
@@ -8976,6 +8861,18 @@ function resolveConfig(options, viteConfig) {
8976
8861
  if (viteConfig.base !== "/")
8977
8862
  resolved.base = viteConfig.base;
8978
8863
  resolved.coverage = resolveC8Options(options.coverage || {}, resolved.root);
8864
+ if (options.shard) {
8865
+ if (resolved.watch)
8866
+ throw new Error("You cannot use --shard option with enabled watch");
8867
+ const [indexString, countString] = options.shard.split("/");
8868
+ const index = Math.abs(parseInt(indexString, 10));
8869
+ const count = Math.abs(parseInt(countString, 10));
8870
+ if (isNaN(count) || count <= 0)
8871
+ throw new Error("--shard <count> must be a positive number");
8872
+ if (isNaN(index) || index <= 0 || index > count)
8873
+ throw new Error("--shard <index> must be a positive number less then <count>");
8874
+ resolved.shard = { index, count };
8875
+ }
8979
8876
  resolved.deps = resolved.deps || {};
8980
8877
  if (resolved.deps.inline !== true) {
8981
8878
  const ssrOptions = viteConfig.ssr || {};
@@ -9012,6 +8909,9 @@ function resolveConfig(options, viteConfig) {
9012
8909
  resolved.reporters.push("default");
9013
8910
  if (resolved.changed)
9014
8911
  resolved.passWithNoTests ?? (resolved.passWithNoTests = true);
8912
+ resolved.css ?? (resolved.css = {});
8913
+ if (typeof resolved.css === "object")
8914
+ (_c = resolved.css).include ?? (_c.include = [/\.module\./]);
9015
8915
  return resolved;
9016
8916
  }
9017
8917
 
@@ -9021,7 +8921,7 @@ function fileFromParsedStack(stack) {
9021
8921
  return join(stack.file, "../", stack.sourcePos.source);
9022
8922
  return stack.file;
9023
8923
  }
9024
- async function printError(error, ctx, options) {
8924
+ async function printError(error, ctx, options = {}) {
9025
8925
  const { showCodeFrame = true, fullStack = false, type } = options;
9026
8926
  let e = error;
9027
8927
  if (typeof error === "string") {
@@ -9143,7 +9043,7 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
9143
9043
  ctx.log(picocolors.exports.red(picocolors.exports.bold("Serialized Error:")), picocolors.exports.gray(propertiesString));
9144
9044
  }
9145
9045
  }
9146
- function generateCodeFrame(source, indent, start = 0, end, range = 2) {
9046
+ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
9147
9047
  var _a;
9148
9048
  start = posToNumber(source, start);
9149
9049
  end = end || start;
@@ -9236,7 +9136,7 @@ function npmRunPath(options = {}) {
9236
9136
  return [...result, path_].join(path$a.delimiter);
9237
9137
  }
9238
9138
 
9239
- function npmRunPathEnv({env = process$1.env, ...options}) {
9139
+ function npmRunPathEnv({env = process$1.env, ...options} = {}) {
9240
9140
  env = {...env};
9241
9141
 
9242
9142
  const path = pathKey({env});
@@ -10896,6 +10796,34 @@ function getIndexStatus(code, from) {
10896
10796
  };
10897
10797
  }
10898
10798
 
10799
+ const cssLangs = "\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)";
10800
+ const cssLangRE = new RegExp(cssLangs);
10801
+ const isCSS = (id) => {
10802
+ return cssLangRE.test(id);
10803
+ };
10804
+ function CSSEnablerPlugin(ctx) {
10805
+ const shouldProcessCSS = (id) => {
10806
+ const { css } = ctx.config;
10807
+ if (typeof css === "boolean")
10808
+ return css;
10809
+ if (toArray$1(css.exclude).some((re) => re.test(id)))
10810
+ return false;
10811
+ if (toArray$1(css.include).some((re) => re.test(id)))
10812
+ return true;
10813
+ return false;
10814
+ };
10815
+ return {
10816
+ name: "vitest:css-enabler",
10817
+ enforce: "pre",
10818
+ transform(code, id) {
10819
+ if (!isCSS(id))
10820
+ return;
10821
+ if (!shouldProcessCSS(id))
10822
+ return { code: "" };
10823
+ }
10824
+ };
10825
+ }
10826
+
10899
10827
  var __defProp = Object.defineProperty;
10900
10828
  var __defProps = Object.defineProperties;
10901
10829
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -11005,10 +10933,15 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
11005
10933
  async configureServer(server) {
11006
10934
  if (haveStarted)
11007
10935
  await ctx.report("onServerRestart");
11008
- await ctx.setServer(options, server);
11009
- haveStarted = true;
11010
- if (options.api && options.watch)
11011
- (await import('./chunk-api-setup.aa092488.mjs')).setup(ctx);
10936
+ try {
10937
+ await ctx.setServer(options, server);
10938
+ haveStarted = true;
10939
+ if (options.api && options.watch)
10940
+ (await import('./chunk-api-setup.8cd5e92a.mjs')).setup(ctx);
10941
+ } catch (err) {
10942
+ ctx.printError(err, true);
10943
+ process.exit(1);
10944
+ }
11012
10945
  if (!options.watch)
11013
10946
  await server.watcher.close();
11014
10947
  }
@@ -11016,6 +10949,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
11016
10949
  EnvReplacerPlugin(),
11017
10950
  MocksPlugin(),
11018
10951
  GlobalSetupPlugin(ctx),
10952
+ CSSEnablerPlugin(ctx),
11019
10953
  options.ui ? await UIPlugin() : null
11020
10954
  ].filter(notNullish);
11021
10955
  }
@@ -1,7 +1,7 @@
1
1
  import { builtinModules, createRequire } from 'module';
2
2
  import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
3
3
  import vm from 'vm';
4
- import { m as isAbsolute$2, l as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.2684ee9f.mjs';
4
+ import { o as isAbsolute$2, m as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.79a8b1cc.mjs';
5
5
  import path from 'path';
6
6
  import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
7
7
  import assert from 'assert';
@@ -2776,7 +2776,7 @@ const compare$b = compare_1$1;
2776
2776
  // - If no C has a prerelease and the LT.semver tuple, return false
2777
2777
  // - Else return true
2778
2778
 
2779
- const subset$1 = (sub, dom, options) => {
2779
+ const subset$1 = (sub, dom, options = {}) => {
2780
2780
  if (sub === dom)
2781
2781
  return true
2782
2782
 
@@ -7290,7 +7290,7 @@ const compare = compare_1;
7290
7290
  // - If no C has a prerelease and the LT.semver tuple, return false
7291
7291
  // - Else return true
7292
7292
 
7293
- const subset = (sub, dom, options) => {
7293
+ const subset = (sub, dom, options = {}) => {
7294
7294
  if (sub === dom)
7295
7295
  return true
7296
7296
 
@@ -7948,7 +7948,7 @@ const defaultFindOptions = {
7948
7948
  return null;
7949
7949
  }
7950
7950
  };
7951
- async function findNearestFile(filename, _options) {
7951
+ async function findNearestFile(filename, _options = {}) {
7952
7952
  const options = { ...defaultFindOptions, ..._options };
7953
7953
  const basePath = resolve(options.startingFrom);
7954
7954
  const leadingSlash = basePath[0] === "/";
@@ -8727,7 +8727,7 @@ function moduleResolve(specifier, base, conditions) {
8727
8727
  const DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set(["node", "import"]);
8728
8728
  const DEFAULT_URL = pathToFileURL(process.cwd());
8729
8729
  const DEFAULT_EXTENSIONS = [".mjs", ".cjs", ".js", ".json"];
8730
- const NOT_FOUND_ERRORS = /* @__PURE__ */ new Set(["ERR_MODULE_NOT_FOUND", "ERR_UNSUPPORTED_DIR_IMPORT", "MODULE_NOT_FOUND"]);
8730
+ const NOT_FOUND_ERRORS = /* @__PURE__ */ new Set(["ERR_MODULE_NOT_FOUND", "ERR_UNSUPPORTED_DIR_IMPORT", "MODULE_NOT_FOUND", "ERR_PACKAGE_PATH_NOT_EXPORTED"]);
8731
8731
  function _tryModuleResolve(id, url, conditions) {
8732
8732
  try {
8733
8733
  return moduleResolve(id, url, conditions);
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { p as picocolors } from './chunk-utils-global.2684ee9f.mjs';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.6b27b039.mjs';
2
+ import { p as picocolors } from './chunk-utils-global.79a8b1cc.mjs';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0ec89ad1.mjs';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
@@ -8,22 +8,23 @@ import 'vite';
8
8
  import 'url';
9
9
  import 'process';
10
10
  import 'fs';
11
- import './chunk-constants.da1921b9.mjs';
11
+ import './chunk-defaults.dc6dc23d.mjs';
12
+ import 'module';
13
+ import './chunk-constants.7b9cfc82.mjs';
12
14
  import 'readline';
13
15
  import 'os';
14
16
  import 'util';
15
17
  import 'stream';
16
18
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
17
- import './chunk-vite-node-utils.b9738a10.mjs';
18
- import 'module';
19
+ import './chunk-vite-node-utils.1bbdb2c1.mjs';
19
20
  import 'vm';
20
21
  import 'assert';
21
22
  import 'debug';
22
- import './chunk-defaults.45dc5e3d.mjs';
23
23
  import 'worker_threads';
24
+ import 'crypto';
24
25
  import 'tinypool';
25
26
  import 'perf_hooks';
26
- import './chunk-utils-source-map.790e5c11.mjs';
27
+ import './chunk-utils-source-map.2556cba8.mjs';
27
28
  import './vendor-index.e5dc6622.mjs';
28
29
  import 'child_process';
29
30
  import 'buffer';
@@ -641,10 +642,10 @@ class CAC extends EventEmitter {
641
642
  }
642
643
  }
643
644
 
644
- const cac = (name) => new CAC(name);
645
+ const cac = (name = "") => new CAC(name);
645
646
 
646
647
  const cli = cac("vitest");
647
- cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
648
+ cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
648
649
  cli.command("run [...filters]").action(run);
649
650
  cli.command("related [...filters]").action(runRelated);
650
651
  cli.command("watch [...filters]").action(start);
package/dist/config.cjs CHANGED
@@ -63,8 +63,12 @@ const config = {
63
63
  ui: false,
64
64
  uiBase: "/__vitest__/",
65
65
  open: true,
66
+ css: {
67
+ include: [/\.module\./]
68
+ },
66
69
  coverage: coverageConfigDefaults,
67
- fakeTimers: fakeTimersDefaults
70
+ fakeTimers: fakeTimersDefaults,
71
+ maxConcurrency: 5
68
72
  };
69
73
  const configDefaults = Object.freeze(config);
70
74
 
package/dist/config.d.ts CHANGED
@@ -91,8 +91,12 @@ declare const config: {
91
91
  ui: boolean;
92
92
  uiBase: string;
93
93
  open: boolean;
94
+ css: {
95
+ include: RegExp[];
96
+ };
94
97
  coverage: ResolvedC8Options;
95
98
  fakeTimers: FakeTimerInstallOpts;
99
+ maxConcurrency: number;
96
100
  };
97
101
  declare const configDefaults: Required<Pick<UserConfig$1, keyof typeof config>>;
98
102
 
package/dist/config.mjs CHANGED
@@ -59,8 +59,12 @@ const config = {
59
59
  ui: false,
60
60
  uiBase: "/__vitest__/",
61
61
  open: true,
62
+ css: {
63
+ include: [/\.module\./]
64
+ },
62
65
  coverage: coverageConfigDefaults,
63
- fakeTimers: fakeTimersDefaults
66
+ fakeTimers: fakeTimersDefaults,
67
+ maxConcurrency: 5
64
68
  };
65
69
  const configDefaults = Object.freeze(config);
66
70
 
package/dist/entry.mjs CHANGED
@@ -1,17 +1,17 @@
1
- export { r as run } from './vendor-entry.ba490394.mjs';
1
+ export { r as run } from './vendor-entry.efeeaa5c.mjs';
2
2
  import 'fs';
3
- import './chunk-utils-global.2684ee9f.mjs';
3
+ import './chunk-utils-global.79a8b1cc.mjs';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
- import './chunk-runtime-chain.52571387.mjs';
7
+ import './chunk-runtime-chain.7103058b.mjs';
8
8
  import 'chai';
9
9
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
10
- import './chunk-runtime-rpc.bcd3613c.mjs';
11
- import './chunk-utils-source-map.790e5c11.mjs';
10
+ import './chunk-runtime-rpc.5e78af38.mjs';
11
+ import './chunk-utils-source-map.2556cba8.mjs';
12
12
  import './chunk-integrations-spy.674b628e.mjs';
13
13
  import 'tinyspy';
14
14
  import 'util';
15
- import './chunk-defaults.45dc5e3d.mjs';
15
+ import './chunk-defaults.dc6dc23d.mjs';
16
16
  import 'module';
17
17
  import 'url';