Skip to content

Commit

Permalink
refactor: keep parser in sync with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jan 22, 2025
1 parent 256faa3 commit dcf6995
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/worker/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ export function astParseFile(filepath: string, code: string) {
if (callee.type === 'TaggedTemplateExpression') {
return getName(callee.tag)
}
if (callee.type === 'SequenceExpression') {
const memberExpression = callee.expressions.find((e: any) => e.type === 'MemberExpression')
if (!memberExpression) {
return null
}
return getName(memberExpression)
}
if (callee.type === 'MemberExpression') {
if (
callee.object?.type === 'Identifier'
Expand All @@ -110,6 +103,13 @@ export function astParseFile(filepath: string, code: string) {
// call as `__vite_ssr__.test.skip()`
return getName(callee.object?.property)
}
// unwrap (0, ...)
if (callee.type === 'SequenceExpression' && callee.expressions.length === 2) {
const [e0, e1] = callee.expressions
if (e0.type === 'Literal' && e0.value === 0) {
return getName(e1)
}
}
return null
}

Expand Down

0 comments on commit dcf6995

Please sign in to comment.