Skip to content

Commit

Permalink
Merge branch 'main' into fix-vite-node-invalidate-source-map-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 24, 2024
2 parents 9af17db + 5df7414 commit d76ab27
Show file tree
Hide file tree
Showing 427 changed files with 2,283 additions and 2,218 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/components/ListItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, effectScope, onMounted, ref } from 'vue'
import { until, useElementVisibility } from '@vueuse/core'
import { computed, effectScope, onMounted, ref } from 'vue'
const el = ref<HTMLDivElement>()
const state = ref(0)
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from 'vitepress'
import { withPwa } from '@vite-pwa/vitepress'
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { withPwa } from '@vite-pwa/vitepress'
import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import { version } from '../../package.json'
import { teamMembers } from './contributors'
import {
contributing,
discord,
Expand All @@ -18,7 +19,6 @@ import {
} from './meta'
import { pwa } from './scripts/pwa'
import { transformHead } from './scripts/transformHead'
import { teamMembers } from './contributors'

export default ({ mode }: { mode: string }) => {
return withPwa(defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
const teamMembers = plainTeamMembers.map(tm => createLinks(tm))
const teamEmeritiMembers = plainTeamEmeritiMembers.map(tm => createLinks(tm))

export { teamMembers, teamEmeritiMembers }
export { teamEmeritiMembers, teamMembers }
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/cli-generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
import { writeFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
import { cliOptionsConfig } from '../../../packages/vitest/src/node/cli/cli-config'

const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/fetch-avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function download(url: string, fileName: string) {
if (existsSync(fileName)) {
return
}
// eslint-disable-next-line no-console

console.log('downloading', fileName)
try {
const image = await (await fetch(url)).arrayBuffer()
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/pwa.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { PwaOptions } from '@vite-pwa/vitepress'
import {
githubusercontentRegex,
pwaFontStylesRegex,
pwaFontsRegex,
pwaFontStylesRegex,
vitestDescription,
vitestName,
vitestShortName,
Expand Down
12 changes: 6 additions & 6 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { inBrowser } from 'vitepress'
import '../style/main.css'
import '../style/vars.css'
import 'uno.css'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import { inBrowser } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
import { h } from 'vue'
import HomePage from '../components/HomePage.vue'
import Version from '../components/Version.vue'
import '../style/main.css'
import '../style/vars.css'
import 'uno.css'
import '@shikijs/vitepress-twoslash/style.css'

if (inBrowser) {
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To communicate between different processes, you can create methods object using
```ts
import { createBirpc } from 'birpc'
import { parse, stringify } from 'flatted'
import { WorkspaceProject, createMethodsRPC } from 'vitest/node'
import { createMethodsRPC, WorkspaceProject } from 'vitest/node'

function createRpc(project: WorkspaceProject, wss: WebSocketServer) {
return createBirpc(
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ A task is an object that is part of a suite. It is automatically added to the cu
// ./utils/custom.js
import { createTaskCollector, getCurrentSuite, setFn } from 'vitest/suite'

export { describe, beforeAll, afterAll } from 'vitest'
export { afterAll, beforeAll, describe } from 'vitest'

// this function will be called during collection phase:
// don't call function handler here, add it to suite tasks
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ You can use it like below in your [setup file](/config/#setupfiles)
```js
import { afterAll, afterEach, beforeAll } from 'vitest'
import { setupServer } from 'msw/node'
import { HttpResponse, graphql, http } from 'msw'
import { graphql, http, HttpResponse } from 'msw'

const posts = [
{
Expand Down
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
"vue": "^3.5.12"
},
"devDependencies": {
"@iconify-json/carbon": "^1.2.2",
"@iconify-json/carbon": "^1.2.3",
"@iconify-json/logos": "^1.2.3",
"@shikijs/vitepress-twoslash": "^1.22.0",
"@unocss/reset": "^0.63.4",
"@unocss/reset": "^0.63.6",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/vitepress": "^0.5.3",
"@vitejs/plugin-vue": "^5.1.4",
"https-localhost": "^4.7.1",
"tinyglobby": "^0.2.9",
"unocss": "^0.63.4",
"unocss": "^0.63.6",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.2.8",
"vite-plugin-pwa": "^0.20.5",
"vitepress": "^1.4.0",
"vitepress": "^1.4.1",
"vitepress-plugin-tabs": "^0.5.0",
"workbox-window": "^7.1.0"
}
Expand Down
6 changes: 3 additions & 3 deletions docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite'
import { defineConfig } from 'vite'
import Components from 'unplugin-vue-components/vite'
import Unocss from 'unocss/vite'
import { presetAttributify, presetIcons, presetUno } from 'unocss'
import Unocss from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'

export default defineConfig({
optimizeDeps: {
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ export default antfu(
files: [
`docs/${GLOB_SRC}`,
`**/*.md`,
`**/*.md/${GLOB_SRC}`,
],
rules: {
'perfectionist/sort-imports': 'off',
'style/max-statements-per-line': 'off',
'import/newline-after-import': 'off',
'import/first': 'off',
Expand All @@ -122,6 +124,7 @@ export default antfu(
`test/${GLOB_SRC}`,
],
rules: {
'antfu/no-top-level-await': 'off',
'unicorn/consistent-function-scoping': 'off',
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/fastify/test/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterAll, expect, test } from 'vitest'
import supertest from 'supertest'
import { afterAll, expect, test } from 'vitest'

import app from '../src/app'
import { usersData } from '../mockData'
import app from '../src/app'

test('with HTTP injection', async () => {
const response = await app.inject({
Expand Down
2 changes: 1 addition & 1 deletion examples/lit/src/my-button.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, css, html } from 'lit'
import { css, html, LitElement } from 'lit'
import { customElement, property } from 'lit/decorators.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/lit/test/basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { page } from '@vitest/browser/context'
import { beforeEach, describe, expect, it } from 'vitest'

import '../src/my-button.js'

Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/packages/client/test/basic.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { expect, test } from 'vitest'
import { render, screen } from '@testing-library/react'
import { userEvent } from '@testing-library/user-event'
import React from 'react'
import { expect, test } from 'vitest'
import Link from '../components/Link.jsx'

test('Link changes the state when hovered', async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/packages/server/test/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterAll, expect, test } from 'vitest'
import supertest from 'supertest'
import { afterAll, expect, test } from 'vitest'

import app from '../src/app'
import { usersData } from '../mockData'
import app from '../src/app'

test('with HTTP injection', async () => {
const response = await app.inject({
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"version": "2.1.3",
"private": true,
"packageManager": "[email protected].1",
"packageManager": "[email protected].2",
"description": "Next generation testing framework powered by Vite",
"engines": {
"node": "^18.0.0 || >=20.0.0"
Expand Down Expand Up @@ -36,22 +36,22 @@
"test:browser:playwright": "pnpm -C test/browser run test:playwright"
},
"devDependencies": {
"@antfu/eslint-config": "3.0.0",
"@antfu/eslint-config": "^3.8.0",
"@antfu/ni": "^0.23.0",
"@playwright/test": "^1.48.0",
"@rollup/plugin-commonjs": "^28.0.0",
"@playwright/test": "^1.48.1",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@types/node": "^22.7.5",
"@types/node": "^22.7.9",
"@types/ws": "^8.5.12",
"@vitest/browser": "workspace:*",
"@vitest/coverage-istanbul": "workspace:*",
"@vitest/coverage-v8": "workspace:*",
"@vitest/ui": "workspace:*",
"bumpp": "^9.6.1",
"bumpp": "^9.7.1",
"changelogithub": "^0.13.11",
"esbuild": "^0.24.0",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"magic-string": "^0.30.12",
"pathe": "^1.1.2",
"rimraf": "^6.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@
"@vitest/mocker": "workspace:*",
"@vitest/utils": "workspace:*",
"magic-string": "^0.30.12",
"msw": "^2.4.9",
"msw": "^2.5.0",
"sirv": "^3.0.0",
"tinyrainbow": "^1.2.0",
"ws": "^8.18.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/jest-dom": "^6.6.2",
"@types/ws": "^8.5.12",
"@vitest/runner": "workspace:*",
"@vitest/ui": "workspace:*",
Expand All @@ -107,8 +107,8 @@
"mime": "^4.0.4",
"pathe": "^1.1.2",
"periscopic": "^4.0.2",
"playwright": "^1.48.0",
"playwright-core": "^1.48.0",
"playwright": "^1.48.1",
"playwright-core": "^1.48.1",
"safaridriver": "^0.1.2",
"vitest": "workspace:*",
"webdriverio": "^8.40.6"
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createRequire } from 'node:module'
import esbuild from 'rollup-plugin-esbuild'
import dts from 'rollup-plugin-dts'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import { defineConfig } from 'rollup'
import dts from 'rollup-plugin-dts'
import esbuild from 'rollup-plugin-esbuild'

const require = createRequire(import.meta.url)
const pkg = require('./package.json')
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/channel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CancelReason } from '@vitest/runner'
import type { MockedModuleSerialized } from '@vitest/mocker'
import type { CancelReason } from '@vitest/runner'
import { getBrowserState } from './utils'

export interface IframeDoneEvent {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CancelReason } from '@vitest/runner'
import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
import { type BirpcReturn, createBirpc } from 'birpc'
import { parse, stringify } from 'flatted'
import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
import { getBrowserState } from './utils'

const PAGE_TYPE = getBrowserState().type
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/client/orchestrator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { SerializedConfig } from 'vitest'
import { channel, client } from '@vitest/browser/client'
import { globalChannel, type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent } from '@vitest/browser/client'
import { generateHash } from '@vitest/runner/utils'
import { type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent, globalChannel } from '@vitest/browser/client'
import { relative } from 'pathe'
import type { SerializedConfig } from 'vitest'
import { getBrowserState, getConfig } from './utils'
import { getUiAPI } from './ui'
import { createModuleMockerInterceptor } from './tester/msw'
import { getUiAPI } from './ui'
import { getBrowserState, getConfig } from './utils'

const url = new URL(location.href)
const ID_ALL = '__vitest_all__'
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/client/tester/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RunnerTask } from 'vitest'
import type { BrowserRPC } from '@vitest/browser/client'
import type { Options as TestingLibraryOptions, UserEvent as TestingLibraryUserEvent } from '@testing-library/user-event'
import type { BrowserRPC } from '@vitest/browser/client'
import type { RunnerTask } from 'vitest'
import type {
BrowserPage,
Locator,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/expect-element.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as matchers from '@testing-library/jest-dom/matchers'
import type { Locator } from '@vitest/browser/context'
import type { ExpectPollOptions } from 'vitest'
import * as matchers from '@testing-library/jest-dom/matchers'
import { chai, expect } from 'vitest'

export async function setupExpectDom() {
Expand Down
10 changes: 5 additions & 5 deletions packages/browser/src/client/tester/locators/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { BrowserRPC } from '@vitest/browser/client'
import type {
LocatorByRoleOptions,
LocatorOptions,
Expand All @@ -7,21 +8,20 @@ import type {
UserEventFillOptions,
UserEventHoverOptions,
} from '@vitest/browser/context'
import type { WorkerGlobalState } from 'vitest'
import type { BrowserRunnerState } from '../../utils'
import { page, server } from '@vitest/browser/context'
import type { BrowserRPC } from '@vitest/browser/client'
import {
Ivya,
type ParsedSelector,
getByAltTextSelector,
getByLabelSelector,
getByPlaceholderSelector,
getByRoleSelector,
getByTestIdSelector,
getByTextSelector,
getByTitleSelector,
Ivya,
type ParsedSelector,
} from 'ivya'
import type { WorkerGlobalState } from 'vitest'
import type { BrowserRunnerState } from '../../utils'
import { getBrowserState, getWorkerState } from '../../utils'
import { getElementError } from '../public-utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/locators/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { page, server } from '@vitest/browser/context'
import { userEvent } from '@testing-library/user-event'
import { page, server } from '@vitest/browser/context'
import {
getByAltTextSelector,
getByLabelSelector,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/msw.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { channel } from '@vitest/browser/client'
import type {
IframeChannelEvent,
IframeMockFactoryRequestEvent,
IframeMockingDoneEvent,
} from '@vitest/browser/client'
import type { MockedModuleSerialized } from '@vitest/mocker'
import { channel } from '@vitest/browser/client'
import { ManualMockedModule } from '@vitest/mocker'
import { ModuleMockerMSWInterceptor } from '@vitest/mocker/browser'
import { nanoid } from '@vitest/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/public-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Locator, type LocatorSelectors, page } from '@vitest/browser/context'
import { type StringifyOptions, stringify } from 'vitest/utils'
import { asLocator } from 'ivya'
import { stringify, type StringifyOptions } from 'vitest/utils'

export function getElementLocatorSelectors(element: Element): LocatorSelectors {
const locator = page.elementLocator(element)
Expand Down
Loading

0 comments on commit d76ab27

Please sign in to comment.