vitest 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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.
|
|
621
|
+
var version = "2.1.1";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -1501,7 +1501,7 @@ async function start(mode, cliFilters, options) {
|
|
|
1501
1501
|
} catch {
|
|
1502
1502
|
}
|
|
1503
1503
|
try {
|
|
1504
|
-
const { startVitest } = await import('./cli-api.
|
|
1504
|
+
const { startVitest } = await import('./cli-api.BKkmK21J.js').then(function (n) { return n.d; });
|
|
1505
1505
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1506
1506
|
if (!ctx?.shouldKeepServer()) {
|
|
1507
1507
|
await ctx?.exit();
|
|
@@ -1523,7 +1523,7 @@ async function init(project) {
|
|
|
1523
1523
|
console.error(new Error('Only the "browser" project is supported. Use "vitest init browser" to create a new project.'));
|
|
1524
1524
|
process.exit(1);
|
|
1525
1525
|
}
|
|
1526
|
-
const { create } = await import('./creator.
|
|
1526
|
+
const { create } = await import('./creator.BteLTfY8.js');
|
|
1527
1527
|
await create();
|
|
1528
1528
|
}
|
|
1529
1529
|
async function collect(mode, cliFilters, options) {
|
|
@@ -1532,7 +1532,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1532
1532
|
} catch {
|
|
1533
1533
|
}
|
|
1534
1534
|
try {
|
|
1535
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1535
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BKkmK21J.js').then(function (n) { return n.d; });
|
|
1536
1536
|
const ctx = await prepareVitest(mode, {
|
|
1537
1537
|
...normalizeCliOptions(options),
|
|
1538
1538
|
watch: false,
|
|
@@ -8,7 +8,7 @@ import { V as VitestCache, d as configDefaults, m as mm, b as resolveConfig, i a
|
|
|
8
8
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
9
9
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
10
10
|
import { ViteNodeServer } from 'vite-node/server';
|
|
11
|
-
import { v as version$1 } from './cac.
|
|
11
|
+
import { v as version$1 } from './cac.BVmpoFAv.js';
|
|
12
12
|
import { createFileTask, getTasks, hasFailed, getTests, getNames } from '@vitest/runner/utils';
|
|
13
13
|
import { n as noop, b as isPrimitive, t as toArray, d as deepMerge, c as nanoid, w as wildcardPatternToRegExp, a as slash, e as stdout } from './base.BlXpj3e_.js';
|
|
14
14
|
import { toArray as toArray$1, notNullish, createDefer } from '@vitest/utils';
|
|
@@ -9688,8 +9688,9 @@ async function resolveWorkspace(vitest, cliOptions, workspaceConfigPath, workspa
|
|
|
9688
9688
|
}, {});
|
|
9689
9689
|
const cwd = process.cwd();
|
|
9690
9690
|
const projects = [];
|
|
9691
|
+
const fileProjects = [...configFiles, ...nonConfigDirectories];
|
|
9691
9692
|
try {
|
|
9692
|
-
for (const filepath of
|
|
9693
|
+
for (const filepath of fileProjects) {
|
|
9693
9694
|
if (vitest.server.config.configFile === filepath) {
|
|
9694
9695
|
const project = await vitest._createCoreProject();
|
|
9695
9696
|
projects.push(project);
|
|
@@ -9732,12 +9733,18 @@ async function resolveWorkspace(vitest, cliOptions, workspaceConfigPath, workspa
|
|
|
9732
9733
|
const name = project.getName();
|
|
9733
9734
|
if (names.has(name)) {
|
|
9734
9735
|
const duplicate = resolvedProjects.find((p) => p.getName() === name && p !== project);
|
|
9736
|
+
const filesError = fileProjects.length ? [
|
|
9737
|
+
"\n\nYour config matched these files:\n",
|
|
9738
|
+
fileProjects.map((p) => ` - ${relative(vitest.config.root, p)}`).join("\n"),
|
|
9739
|
+
"\n\n"
|
|
9740
|
+
].join("") : [" "];
|
|
9735
9741
|
throw new Error([
|
|
9736
9742
|
`Project name "${name}"`,
|
|
9737
9743
|
project.server.config.configFile ? ` from "${relative(vitest.config.root, project.server.config.configFile)}"` : "",
|
|
9738
9744
|
" is not unique.",
|
|
9739
9745
|
duplicate?.server.config.configFile ? ` The project is already defined by "${relative(vitest.config.root, duplicate.server.config.configFile)}".` : "",
|
|
9740
|
-
|
|
9746
|
+
filesError,
|
|
9747
|
+
"All projects in a workspace should have unique names. Make sure your configuration is correct."
|
|
9741
9748
|
].join(""));
|
|
9742
9749
|
}
|
|
9743
9750
|
names.add(name);
|
|
@@ -9785,29 +9792,29 @@ async function resolveWorkspaceProjectConfigs(vitest, workspaceConfigPath, works
|
|
|
9785
9792
|
} else {
|
|
9786
9793
|
projectsOptions.push(await definition);
|
|
9787
9794
|
}
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
nonConfigProjectDirectories.push(filepath);
|
|
9805
|
-
}
|
|
9795
|
+
}
|
|
9796
|
+
if (workspaceGlobMatches.length) {
|
|
9797
|
+
const globOptions = {
|
|
9798
|
+
absolute: true,
|
|
9799
|
+
dot: true,
|
|
9800
|
+
onlyFiles: false,
|
|
9801
|
+
cwd: vitest.config.root,
|
|
9802
|
+
expandDirectories: false,
|
|
9803
|
+
ignore: ["**/node_modules/**", "**/*.timestamp-*"]
|
|
9804
|
+
};
|
|
9805
|
+
const workspacesFs = await glob(workspaceGlobMatches, globOptions);
|
|
9806
|
+
await Promise.all(workspacesFs.map(async (filepath) => {
|
|
9807
|
+
if (filepath.endsWith("/")) {
|
|
9808
|
+
const configFile = await resolveDirectoryConfig(filepath);
|
|
9809
|
+
if (configFile) {
|
|
9810
|
+
workspaceConfigFiles.push(configFile);
|
|
9806
9811
|
} else {
|
|
9807
|
-
|
|
9812
|
+
nonConfigProjectDirectories.push(filepath);
|
|
9808
9813
|
}
|
|
9809
|
-
}
|
|
9810
|
-
|
|
9814
|
+
} else {
|
|
9815
|
+
workspaceConfigFiles.push(filepath);
|
|
9816
|
+
}
|
|
9817
|
+
}));
|
|
9811
9818
|
}
|
|
9812
9819
|
const projectConfigFiles = Array.from(new Set(workspaceConfigFiles));
|
|
9813
9820
|
return {
|
|
@@ -40,7 +40,7 @@ import { expect, test } from 'vitest'
|
|
|
40
40
|
import { render } from '@testing-library/jsx'
|
|
41
41
|
import HelloWorld from './HelloWorld.jsx'
|
|
42
42
|
|
|
43
|
-
test('renders name', () => {
|
|
43
|
+
test('renders name', async () => {
|
|
44
44
|
const { getByText } = render(<HelloWorld name="Vitest" />)
|
|
45
45
|
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
|
|
46
46
|
})
|
|
@@ -79,7 +79,7 @@ import { expect, test } from 'vitest'
|
|
|
79
79
|
import { render } from 'vitest-browser-vue'
|
|
80
80
|
import HelloWorld from './HelloWorld.vue'
|
|
81
81
|
|
|
82
|
-
test('renders name', () => {
|
|
82
|
+
test('renders name', async () => {
|
|
83
83
|
const { getByText } = render(HelloWorld, {
|
|
84
84
|
props: { name: 'Vitest' },
|
|
85
85
|
})
|
|
@@ -108,7 +108,7 @@ import { expect, test } from 'vitest'
|
|
|
108
108
|
import { render } from 'vitest-browser-svelte'
|
|
109
109
|
import HelloWorld from './HelloWorld.svelte'
|
|
110
110
|
|
|
111
|
-
test('renders name', () => {
|
|
111
|
+
test('renders name', async () => {
|
|
112
112
|
const { getByText } = render(HelloWorld, { name: 'Vitest' })
|
|
113
113
|
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
|
|
114
114
|
})
|
package/dist/cli.js
CHANGED
package/dist/node.js
CHANGED
|
@@ -2,8 +2,8 @@ import { createServer as createServer$1 } from 'vite';
|
|
|
2
2
|
export { createLogger as createViteLogger, isFileServingAllowed, parseAst, parseAstAsync } from 'vite';
|
|
3
3
|
import { f as TestModule } from './chunks/index.zPibhCkV.js';
|
|
4
4
|
export { e as TestCase, i as TestProject, g as TestSuite } from './chunks/index.zPibhCkV.js';
|
|
5
|
-
export { G as GitNotFoundError, T as TestSpecification, F as TestsNotFoundError, a as VitestPackageInstaller, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, b as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
5
|
+
export { G as GitNotFoundError, T as TestSpecification, F as TestsNotFoundError, a as VitestPackageInstaller, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, b as resolveFsAllow, s as startVitest } from './chunks/cli-api.BKkmK21J.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.BVmpoFAv.js';
|
|
7
7
|
export { c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig, b as resolveConfig } from './chunks/resolveConfig.-K5hHm0S.js';
|
|
8
8
|
import createDebug from 'debug';
|
|
9
9
|
export { distDir, rootDir } from './path.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
123
123
|
"happy-dom": "*",
|
|
124
124
|
"jsdom": "*",
|
|
125
|
-
"@vitest/browser": "2.1.
|
|
126
|
-
"@vitest/ui": "2.1.
|
|
125
|
+
"@vitest/browser": "2.1.1",
|
|
126
|
+
"@vitest/ui": "2.1.1"
|
|
127
127
|
},
|
|
128
128
|
"peerDependenciesMeta": {
|
|
129
129
|
"@edge-runtime/vm": {
|
|
@@ -157,14 +157,14 @@
|
|
|
157
157
|
"tinyrainbow": "^1.2.0",
|
|
158
158
|
"vite": "^5.0.0",
|
|
159
159
|
"why-is-node-running": "^2.3.0",
|
|
160
|
-
"@vitest/
|
|
161
|
-
"@vitest/runner": "2.1.
|
|
162
|
-
"@vitest/
|
|
163
|
-
"@vitest/
|
|
164
|
-
"@vitest/spy": "2.1.
|
|
165
|
-
"
|
|
166
|
-
"@vitest/utils": "2.1.
|
|
167
|
-
"
|
|
160
|
+
"@vitest/mocker": "2.1.1",
|
|
161
|
+
"@vitest/runner": "2.1.1",
|
|
162
|
+
"@vitest/snapshot": "2.1.1",
|
|
163
|
+
"@vitest/pretty-format": "^2.1.1",
|
|
164
|
+
"@vitest/spy": "2.1.1",
|
|
165
|
+
"vite-node": "2.1.1",
|
|
166
|
+
"@vitest/utils": "2.1.1",
|
|
167
|
+
"@vitest/expect": "2.1.1"
|
|
168
168
|
},
|
|
169
169
|
"devDependencies": {
|
|
170
170
|
"@ampproject/remapping": "^2.3.0",
|