Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/advanced/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export interface VitestRunner {
/**
* Publicly available configuration.
*/
config: VitestRunnerConfig
config: SerializedConfig
/**
* The name of the current pool. Can affect how stack trace is inferred on the server side.
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/api/advanced/vitest.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This is a global [`ViteDevServer`](https://vite.dev/guide/api-javascript#vitedev
Public `state` is an experimental API (except `vitest.state.getReportedEntity`). Breaking changes might not follow SemVer, please pin Vitest's version when using it.
:::

Global state stores information about the current tests. It uses the same API from `@vitest/runner` by default, but we recommend using the [Reported Tasks API](/api/advanced/reporters#reported-tasks) instead by calling `state.getReportedEntity()` on the `@vitest/runner` API:
Global state stores information about the current tests. It uses internal serializable Task API by default, but we recommend using the [Reported Tasks API](/api/advanced/reporters#reported-tasks) instead by calling `state.getReportedEntity()`:

```ts
const task = vitest.state.idMap.get(taskId) // old API
Expand Down
1 change: 0 additions & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"@types/node": "catalog:",
"@types/pngjs": "^6.0.5",
"@types/ws": "catalog:",
"@vitest/runner": "workspace:*",
"birpc": "catalog:",
"flatted": "catalog:",
"ivya": "^1.8.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/browser/src/client/channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { CancelReason, FileSpecification } from '@vitest/runner'
import type { CancelReason } from 'vitest'
import type { FileSpecification } from 'vitest/internal/browser'
import type { OTELCarrier } from 'vitest/internal/traces'
import { getBrowserState } from './utils'

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,6 +1,6 @@
import type { ModuleMocker } from '@vitest/mocker/browser'
import type { CancelReason } from '@vitest/runner'
import type { BirpcReturn } from 'birpc'
import type { CancelReason } from 'vitest'
import type { MarkOptions } from 'vitest/browser'
import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../types'
import type { IframeOrchestrator } from './orchestrator'
Expand Down
37 changes: 3 additions & 34 deletions packages/browser/src/client/orchestrator.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { Context as OTELContext } from '@opentelemetry/api'
import type { GlobalChannelIncomingEvent, IframeChannelIncomingEvent, IframeChannelOutgoingEvent, IframeViewportDoneEvent, IframeViewportFailEvent } from '@vitest/browser/client'
import type { FileSpecification } from '@vitest/runner'
import type { BrowserTesterOptions, SerializedConfig } from 'vitest'
import type { FileSpecification } from 'vitest/internal/browser'
import { channel, client, globalChannel } from '@vitest/browser/client'
import { relative } from 'pathe'
import { Traces } from 'vitest/internal/traces'
// This needs to be tree shaken properly to not include the whole runner by accident
import { generateFileHash } from '../../../vitest/src/utils/tasks.js'
import { getUiAPI } from './ui'
import { getBrowserState, getConfig } from './utils'

Expand Down Expand Up @@ -481,39 +483,6 @@ function generateFileId(file: string) {
)
}

// TODO: copied from packages/runner/src/utils/collect.ts
interface HashMeta {
typecheck?: boolean
__vitest_label__?: string
}

function generateFileHash(
file: string,
projectName: string | undefined,
meta?: HashMeta,
): string {
const seed = [
file,
projectName || '',
meta?.typecheck ? '__typecheck__' : '',
meta?.__vitest_label__ || '',
].join('\0')
return generateHash(seed)
}

function generateHash(str: string): string {
let hash = 0
if (str.length === 0) {
return `${hash}`
}
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i)
hash = (hash << 5) - hash + char
hash = hash & hash // Convert to 32bit integer
}
return `${hash}`
}

async function setIframeViewport(
width: number,
height: number,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { VisualRegressionArtifact } from '@vitest/runner'
import type { AsyncMatcherResult, MatcherState } from 'vitest'
import type { AsyncMatcherResult, MatcherState, VisualRegressionArtifact } from 'vitest'
import type { BrowserPage, ScreenshotMatcherOptions } from '../../../../context'
import type { ScreenshotMatcherArguments, ScreenshotMatcherOutput } from '../../../shared/screenshotMatcher/types'
import type { Locator } from '../locators'
Expand Down
22 changes: 12 additions & 10 deletions packages/browser/src/client/tester/runner.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import type {
CancelReason,
File,
Suite,
Task,
TaskEventPack,
TaskResultPack,
Test,
RunnerTestFile as File,
SerializedConfig,
RunnerTestSuite as Suite,
RunnerTask as Task,
RunnerTaskEventPack as TaskEventPack,
RunnerTaskResultPack as TaskResultPack,
RunnerTestCase as Test,
TestAnnotation,
TestArtifact,
TestExecutionMethod,
TestTryOptions,
VitestRunner,
} from '@vitest/runner'
import type { SerializedConfig, TestExecutionMethod, WorkerGlobalState } from 'vitest'
VitestTestRunner as VitestRunner,
WorkerGlobalState,
} from 'vitest'
import type { VitestBrowserClientMocker } from './mocker'
import type { CommandsManager } from './tester-utils'
import { globalChannel, onCancel } from '@vitest/browser/client'
import { getTestName } from '@vitest/runner/utils'
import { recordArtifact, TestRunner } from 'vitest'
import { page, userEvent } from 'vitest/browser'
import {
Expand All @@ -26,6 +27,7 @@ import {
takeCoverageInsideWorker,
} from 'vitest/internal/browser'
import { createStackString, parseStacktrace } from '../../../../utils/src/source-map'
import { getTestName } from '../../../../vitest/src/utils/tasks'
import { getBrowserState, getWorkerState, moduleRunner, now } from '../utils'
import { rpc } from './rpc'
import { VitestBrowserSnapshotEnvironment } from './snapshot'
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/tester.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BrowserRPC, IframeChannelEvent } from '@vitest/browser/client'
import type { FileSpecification } from '@vitest/runner'
import type { FileSpecification } from 'vitest/internal/browser'
import { channel, client, onCancel, registerPageMarkHandler } from '@vitest/browser/client'
import { parse } from 'flatted'
import { page, server, userEvent } from 'vitest/browser'
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/trace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Task } from '@vitest/runner'
import type { RunnerTask as Task } from 'vitest'
import type { BrowserTraceEntryKind } from 'vitest/browser'
import type { BrowserRPC } from '../client'
import type { SerializedLocator } from './locators'
Expand Down
5 changes: 2 additions & 3 deletions packages/browser/src/client/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { VitestRunner } from '@vitest/runner'
import type { Ivya } from 'ivya'
import type { SerializedConfig, WorkerGlobalState } from 'vitest'
import type { SerializedConfig, VitestTestRunner, WorkerGlobalState } from 'vitest'
import type { OTELCarrier, Traces } from 'vitest/internal/traces'
import type { IframeOrchestrator } from './orchestrator'
import type { CommandsManager } from './tester/tester-utils'
Expand Down Expand Up @@ -80,7 +79,7 @@ export interface BrowserRunnerState {
runningFiles: string[]
config: SerializedConfig
provider: string
runner: VitestRunner
runner: VitestTestRunner
viteConfig: {
root: string
}
Expand Down
1 change: 0 additions & 1 deletion packages/browser/src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export default (parentServer: ParentBrowserProject, base = '/'): Plugin[] => {
'@vitest/browser/client',
'@vitest/utils',
'@vitest/utils/source-map',
'@vitest/runner',
'@vitest/spy',
'@vitest/utils/error',
'std-env',
Expand Down
5 changes: 4 additions & 1 deletion packages/browser/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import type { MockedModuleSerialized, ServerIdResolution, ServerMockResolution } from '@vitest/mocker'
import type { BaselineData, TaskEventPack, TaskResultPack, TestArtifact } from '@vitest/runner'
import type { BirpcReturn } from 'birpc'
import type {
AfterSuiteRunMeta,
BaselineData,
BrowserTesterOptions,
CancelReason,
RunnerTestFile,
SerializedTestSpecification,
SnapshotResult,
RunnerTaskEventPack as TaskEventPack,
RunnerTaskResultPack as TaskResultPack,
TestArtifact,
TestBenchmark,
TestExecutionMethod,
UserConsoleLog,
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @vitest/expect

[![NPM version](https://img.shields.io/npm/v/@vitest/runner?color=a1b858&label=)](https://npmx.dev/package/@vitest/runner)
[![NPM version](https://img.shields.io/npm/v/@vitest/expect?color=a1b858&label=)](https://npmx.dev/package/@vitest/expect)

Jest's expect matchers as a Chai plugin.

Expand Down
3 changes: 0 additions & 3 deletions packages/expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,5 @@
"@vitest/utils": "workspace:*",
"chai": "catalog:",
"tinyrainbow": "catalog:"
},
"devDependencies": {
"@vitest/runner": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/expect/src/jest-expect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Test } from '@vitest/runner'
import type { MockInstance, MockResult, MockSettledResult } from '@vitest/spy'
import type { Constructable } from '@vitest/utils'
import type { Test } from '../../vitest/src/runtime/runner/types'
import type { AsymmetricMatcher } from './jest-asymmetric-matchers'
import type { Assertion, ChaiPlugin } from './types'
import { isMockFunction } from '@vitest/spy'
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/jest-extend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Test } from '@vitest/runner'
import type { Test } from '../../vitest/src/runtime/runner/types'
import type {
ChaiPlugin,
ExpectStatic,
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Test } from '@vitest/runner/types'
import type { Test } from '../../vitest/src/runtime/runner/types'
import type { Assertion } from './types'
import { processError } from '@vitest/utils/error'
import { noop } from '@vitest/utils/helpers'
Expand Down
7 changes: 0 additions & 7 deletions packages/runner/README.md

This file was deleted.

54 changes: 0 additions & 54 deletions packages/runner/package.json

This file was deleted.

65 changes: 0 additions & 65 deletions packages/runner/rollup.config.js

This file was deleted.

24 changes: 0 additions & 24 deletions packages/runner/src/index.ts

This file was deleted.

Loading
Loading