Skip to content

Commit

Permalink
Merge branch 'main' into fix-vitest-ui-rpc-cors
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Feb 2, 2025
2 parents 209bf3d + c82387d commit 9e76ab8
Show file tree
Hide file tree
Showing 66 changed files with 1,424 additions and 1,113 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ body:
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages '{vitest,@vitest/*,vite,@vitejs/*}' --binaries --browsers`
description: Output of `npx envinfo --system --npmPackages '{vitest*,@vitest/*,vite,@vitejs/*,playwright,webdriverio}' --binaries --browsers`
render: shell
placeholder: System, Binaries, Browsers
validations:
Expand Down
6 changes: 3 additions & 3 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"@types/chai",
"@sinonjs/fake-timers",
"cac",
// Pinned due to https://github.com/vitest-dev/vitest/issues/4710
"log-update",
// Pinned because it requires "node" condition in the new version
// But we intentionally build Vitest ambiguously
"find-up",
// Transitive dependency that we patch
"acorn"
"acorn",
// Keep using codemirror 5
"codemirror"
]
}
2 changes: 1 addition & 1 deletion docs/api/vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ This will clear mock history and reset each mock's implementation to its origina
### vi.restoreAllMocks

Calls [`.mockRestore()`](/api/mock#mockrestore) on all spies.
This will clear mock history, restore all original mock implementations, , and restore original descriptors of spied-on objects.
This will clear mock history, restore all original mock implementations, and restore original descriptors of spied-on objects.

### vi.spyOn

Expand Down
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ When using coverage, Vitest automatically adds test files `include` patterns to
### exclude

- **Type:** `string[]`
- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*']`
- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']`
- **CLI:** `vitest --exclude "**/excluded-file"`

A list of glob patterns that should be excluded from your test files.
Expand Down
4 changes: 4 additions & 0 deletions docs/guide/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ expect(() => {

See PR for more details: [#5876](https://github.com/vitest-dev/vitest/pull/5876).

### `module` condition export is not resolved by default on Vite 6

Vite 6 allows more flexible [`resolve.conditions`](https://vite.dev/config/shared-options#resolve-conditions) options and Vitest configures it to exclude `module` conditional export by default.

### `Custom` Type is Deprecated <Badge type="danger">API</Badge> {#custom-type-is-deprecated}

The `Custom` type is now an alias for the `Test` type. Note that Vitest updated the public types in 2.1 and changed exported names to `RunnerCustomCase` and `RunnerTestCase`:
Expand Down
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"generate-pwa-icons": "pwa-assets-generator"
},
"dependencies": {
"@vueuse/core": "^12.4.0",
"@vueuse/core": "^12.5.0",
"vue": "^3.5.12"
},
"devDependencies": {
"@iconify-json/carbon": "^1.2.5",
"@iconify-json/logos": "^1.2.4",
"@shikijs/transformers": "^1.27.2",
"@shikijs/vitepress-twoslash": "^1.27.2",
"@shikijs/transformers": "^1.29.1",
"@shikijs/vitepress-twoslash": "^1.29.1",
"@unocss/reset": "^0.65.4",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/vitepress": "^0.5.3",
Expand All @@ -32,8 +32,8 @@
"unplugin-vue-components": "^0.28.0",
"vite": "^5.2.8",
"vite-plugin-pwa": "^0.21.1",
"vitepress": "^1.5.0",
"vitepress-plugin-group-icons": "^1.3.4",
"vitepress": "^1.6.3",
"vitepress-plugin-group-icons": "^1.3.5",
"vitepress-plugin-tabs": "^0.5.0",
"workbox-window": "^7.3.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/in-source-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test:run": "vitest run"
},
"devDependencies": {
"typescript": "^5.5.4",
"typescript": "^5.7.3",
"vitest": "latest"
}
}
2 changes: 1 addition & 1 deletion examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"svelte": "^3.59.1",
"svelte-check": "^3.4.3",
"tslib": "^2.5.3",
"typescript": "^5.2.2",
"typescript": "^5.7.3",
"vite": "latest",
"vitest": "latest"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/typecheck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@types/node": "^20.11.5",
"@vitest/ui": "latest",
"typescript": "^5.2.2",
"typescript": "^5.7.3",
"vite": "latest",
"vitest": "latest"
},
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/monorepo",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"private": true,
"packageManager": "pnpm@9.15.4",
"description": "Next generation testing framework powered by Vite",
Expand Down Expand Up @@ -42,20 +42,20 @@
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@types/node": "^22.10.7",
"@types/node": "^22.10.9",
"@types/ws": "^8.5.13",
"@vitest/browser": "workspace:*",
"@vitest/coverage-istanbul": "workspace:*",
"@vitest/coverage-v8": "workspace:*",
"@vitest/ui": "workspace:*",
"bumpp": "^9.10.1",
"changelogithub": "^0.13.11",
"bumpp": "^9.10.2",
"changelogithub": "^13.12.1",
"esbuild": "^0.24.2",
"eslint": "^9.18.0",
"magic-string": "^0.30.17",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"rimraf": "^6.0.1",
"rollup": "^4.30.1",
"rollup": "^4.31.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-license": "^3.5.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/browser",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Browser running for Vitest",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down Expand Up @@ -88,7 +88,7 @@
},
"dependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/user-event": "^14.6.0",
"@testing-library/user-event": "^14.6.1",
"@vitest/mocker": "workspace:*",
"@vitest/utils": "workspace:*",
"magic-string": "^0.30.17",
Expand All @@ -108,7 +108,7 @@
"flatted": "^3.3.2",
"ivya": "^1.1.1",
"mime": "^4.0.6",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"periscopic": "^4.0.2",
"playwright": "^1.49.1",
"playwright-core": "^1.49.1",
Expand Down
10 changes: 9 additions & 1 deletion packages/browser/src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ export default (parentServer: ParentBrowserProject, base = '/'): Plugin[] => {
}

const url = new URL(req.url, 'http://localhost')
const file = url.searchParams.get('file')
const id = url.searchParams.get('id')
if (!id) {
res.statusCode = 404
res.end()
return
}

const task = parentServer.vitest.state.idMap.get(id)
const file = task?.meta.failScreenshotPath
if (!file) {
res.statusCode = 404
res.end()
Expand Down
3 changes: 3 additions & 0 deletions packages/browser/src/node/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export function createBrowserPool(vitest: Vitest): ProcessPool {
}
await project._initBrowserProvider()

if (!project.browser) {
throw new TypeError(`The browser server was not initialized${project.name ? ` for the "${project.name}" project` : ''}. This is a bug in Vitest. Please, open a new issue with reproduction.`)
}
await executeTests(method, project, files)
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/coverage-istanbul/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/coverage-istanbul",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Istanbul coverage provider for Vitest",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
Expand Down Expand Up @@ -63,7 +63,7 @@
"@types/istanbul-lib-source-maps": "^4.0.4",
"@types/istanbul-reports": "^3.0.4",
"@types/test-exclude": "^6.0.2",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"vitest": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions packages/coverage-v8/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/coverage-v8",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "V8 coverage provider for Vitest",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
Expand Down Expand Up @@ -75,7 +75,7 @@
"@types/istanbul-reports": "^3.0.4",
"@types/test-exclude": "^6.0.2",
"@vitest/browser": "workspace:*",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"v8-to-istanbul": "^9.3.0",
"vite-node": "workspace:*",
"vitest": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/expect",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Jest's expect matchers as a Chai plugin",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down
4 changes: 2 additions & 2 deletions packages/mocker/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/mocker",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Vitest module mocker implementation",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down Expand Up @@ -76,7 +76,7 @@
"@vitest/utils": "workspace:*",
"acorn-walk": "^8.3.4",
"msw": "^2.7.0",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"vite": "^5.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/pretty-format/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/pretty-format",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Fork of pretty-format with support for ESM",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down
4 changes: 2 additions & 2 deletions packages/runner/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/runner",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Vitest test runner",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down Expand Up @@ -43,6 +43,6 @@
},
"dependencies": {
"@vitest/utils": "workspace:*",
"pathe": "^2.0.1"
"pathe": "^2.0.2"
}
}
4 changes: 2 additions & 2 deletions packages/snapshot/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/snapshot",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Vitest snapshot manager",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down Expand Up @@ -44,7 +44,7 @@
"dependencies": {
"@vitest/pretty-format": "workspace:*",
"magic-string": "^0.30.17",
"pathe": "^2.0.1"
"pathe": "^2.0.2"
},
"devDependencies": {
"@types/natural-compare": "^1.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/spy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/spy",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Lightweight Jest compatible spy implementation",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/client/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ declare global {
const useCodeMirror: typeof import('./composables/codemirror')['useCodeMirror']
const useColorMode: typeof import('@vueuse/core')['useColorMode']
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
const useCountdown: typeof import('@vueuse/core')['useCountdown']
const useCounter: typeof import('@vueuse/core')['useCounter']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVar: typeof import('@vueuse/core')['useCssVar']
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/client/components/views/ViewReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ const showScreenshot = ref(false)
const timestamp = ref(Date.now())
const currentTask = ref<Task | undefined>()
const currentScreenshotUrl = computed(() => {
const file = currentTask.value?.meta.failScreenshotPath
const id = currentTask.value?.id
// force refresh
const t = timestamp.value
// browser plugin using /, change this if base can be modified
return file ? `/__screenshot-error?file=${encodeURIComponent(file)}&t=${t}` : undefined
return id ? `/__screenshot-error?id=${encodeURIComponent(id)}&t=${t}` : undefined
})
function showScreenshotModal(task: Task) {
Expand Down
10 changes: 5 additions & 5 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/ui",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "UI for Vitest",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down Expand Up @@ -50,7 +50,7 @@
"@vitest/utils": "workspace:*",
"fflate": "^0.8.2",
"flatted": "^3.3.2",
"pathe": "^2.0.1",
"pathe": "^2.0.2",
"sirv": "^3.0.0",
"tinyglobby": "^0.2.10",
"tinyrainbow": "^2.0.0"
Expand All @@ -69,14 +69,14 @@
"@vitest/runner": "workspace:*",
"@vitest/ws-client": "workspace:*",
"@vue/test-utils": "^2.4.6",
"@vueuse/core": "^12.4.0",
"@vueuse/core": "^12.5.0",
"ansi-to-html": "^0.7.2",
"birpc": "0.2.19",
"codemirror": "^5.65.18",
"codemirror-theme-vars": "^0.1.2",
"d3-graph-controller": "^3.0.11",
"d3-graph-controller": "^3.0.12",
"floating-vue": "^5.2.2",
"rollup": "^4.30.1",
"rollup": "^4.31.0",
"splitpanes": "^3.1.8",
"unocss": "^0.65.4",
"unplugin-auto-import": "^0.19.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vitest/utils",
"type": "module",
"version": "3.0.3",
"version": "3.0.4",
"description": "Shared Vitest utility functions",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ export function parseSingleV8Stack(raw: string): ParsedStack | null {
}

// normalize Windows path (\ -> /)
file = resolve(file)
file = file.startsWith('node:') || file.startsWith('internal:')
? file
: resolve(file)

if (method) {
method = method.replace(/__vite_ssr_import_\d+__\./g, '')
Expand Down
Loading

0 comments on commit 9e76ab8

Please sign in to comment.