Skip to content

Commit 1bca323

Browse files
authored
test: add tests for experimental_parseSpecification (#9440)
1 parent e59c94b commit 1bca323

File tree

2 files changed

+835
-6
lines changed

2 files changed

+835
-6
lines changed

packages/vitest/src/node/ast-collect.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function astParseFile(filepath: string, code: string) {
123123
const property = callee?.property?.name
124124
let mode = !property || property === name ? 'run' : property
125125
// they will be picked up in the next iteration
126-
if (['each', 'for', 'skipIf', 'runIf'].includes(mode)) {
126+
if (['each', 'for', 'skipIf', 'runIf', 'extend', 'scoped'].includes(mode)) {
127127
return
128128
}
129129

@@ -308,7 +308,10 @@ function createFileTask(
308308
'->',
309309
`${originalLocation.line}:${originalLocation.column}`,
310310
)
311-
location = originalLocation
311+
location = {
312+
line: originalLocation.line,
313+
column: originalLocation.column,
314+
}
312315
}
313316
else {
314317
debug?.(
@@ -421,11 +424,11 @@ export async function astCollectTests(
421424
}
422425

423426
async function transformSSR(project: TestProject, filepath: string) {
424-
const request = await project.vite.transformRequest(filepath, { ssr: false })
425-
if (!request) {
426-
return null
427+
const environment = project.config.environment
428+
if (environment === 'jsdom' || environment === 'happy-dom') {
429+
return project.vite.environments.client.transformRequest(filepath)
427430
}
428-
return await project.vite.ssrTransform(request.code, request.map, filepath)
431+
return project.vite.environments.ssr.transformRequest(filepath)
429432
}
430433

431434
function markDynamicTests(tasks: Task[]) {

0 commit comments

Comments
 (0)