Skip to content

Commit

Permalink
test: branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 14, 2024
1 parent 123ab70 commit 2dd340f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 0 additions & 2 deletions packages/vitest/src/typecheck/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export async function collectTests(
ctx: WorkspaceProject,
filepath: string,
): Promise<null | FileInformation> {
// TODO: can we avoid ssr transform entirely?
// const request = await ctx.server.transformRequest(filepath)
const request = await ctx.vitenode.transformRequest(filepath, filepath)
if (!request) {
return null
Expand Down
15 changes: 11 additions & 4 deletions test/cli/test/inspect.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { InspectorNotification } from 'node:inspector'
import { version as viteVersion } from 'vite'
import { expect, test } from 'vitest'
import WebSocket from 'ws'

Expand Down Expand Up @@ -35,10 +36,16 @@ test('--inspect-brk stops at test file', async () => {
send({ method: 'Debugger.getScriptSource', params: { scriptId } })
const { result } = await response as any

// due to vite ssr transform
// __vite_ssr_identity__(__vite_ssr_import_0__.test)(...)
expect(result.scriptSource).toContain('test)("sum", () => {')
expect(result.scriptSource).toContain('expect)(1 + 1).toBe(2)')
if (viteVersion[0] >= '6') {
// vite ssr transform wraps import by
// __vite_ssr_identity__(__vite_ssr_import_0__.test)(...)
expect(result.scriptSource).toContain('test)("sum", () => {')
expect(result.scriptSource).toContain('expect)(1 + 1).toBe(2)')
}
else {
expect(result.scriptSource).toContain('test("sum", () => {')
expect(result.scriptSource).toContain('expect(1 + 1).toBe(2)')
}

send({ method: 'Debugger.resume' })

Expand Down

0 comments on commit 2dd340f

Please sign in to comment.