Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhubail committed Oct 31, 2024
1 parent 7111ad3 commit 7a53882
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/runner/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ export async function runFiles(files: File[], runner: VitestRunner): Promise<voi
}
}

export async function startTests(specs: FileSpec[], runner: VitestRunner): Promise<File[]> {
const paths = specs.map(f => f.filepath)
export async function startTests(specs: string[] | FileSpec[], runner: VitestRunner): Promise<File[]> {
const paths = specs.map(f => typeof f === 'string' ? f : f.filepath)
await runner.onBeforeCollect?.(paths)

const files = await collectTests(specs, runner)
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/node/pools/forks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { FileSpec } from '@vitest/runner/types/runner'
import type { TinypoolChannel, Options as TinypoolOptions } from 'tinypool'
import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
import type { ContextRPC, ContextTestEnvironment } from '../../types/worker'
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/node/pools/vmThreads.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { FileSpec } from '@vitest/runner/types/runner'
import type { Options as TinypoolOptions } from 'tinypool'
import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
import type { ContextTestEnvironment } from '../../types/worker'
Expand Down
3 changes: 1 addition & 2 deletions packages/vitest/src/node/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export class TestSpecification {
workspaceProject: WorkspaceProject,
moduleId: string,
pool: Pool,
// location?: WorkspaceSpecLocation | undefined,
testLocations: number[] | undefined,
testLocations?: number[] | undefined,
) {
this[0] = workspaceProject
this[1] = moduleId
Expand Down
4 changes: 3 additions & 1 deletion packages/vitest/src/runtime/inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export function setupInspect(ctx: ContextRPC) {
)

if (config.inspectBrk) {
const firstTestFile = ctx.files[0]
const firstTestFile = typeof ctx.files[0] === 'string'
? ctx.files[0]
: ctx.files[0].filepath

// Stop at first test file
if (firstTestFile) {
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/runtime/runBaseTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function run(
resetModules(workerState.moduleCache, true)
}

workerState.filepath = file.file
workerState.filepath = file.filepath

if (method === 'run') {
await startTests([file], runner)
Expand Down

0 comments on commit 7a53882

Please sign in to comment.