Skip to content

Commit

Permalink
fix(vitest): simplify hoist transform check regex to avoid expensive …
Browse files Browse the repository at this point in the history
…regex match (#4974)
  • Loading branch information
hi-ogawa committed Jan 16, 2024
1 parent 06bae4d commit df0db6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vitest/src/node/hoistMocks.ts
Expand Up @@ -60,7 +60,7 @@ export function getBetterEnd(code: string, node: Node) {
return end
}

const regexpHoistable = /[ \t]*\b(vi|vitest)\s*\.\s*(mock|unmock|hoisted)\(/
const regexpHoistable = /\b(vi|vitest)\s*\.\s*(mock|unmock|hoisted)\(/
const hashbangRE = /^#!.*\n/

export function hoistMocks(code: string, id: string, parse: PluginContext['parse'], colors?: Colors) {
Expand Down

0 comments on commit df0db6a

Please sign in to comment.