Skip to content

Commit

Permalink
refactor: remove unused "m" flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jan 15, 2024
1 parent 0b28f30 commit c3de3ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vitest/src/node/hoistMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function getBetterEnd(code: string, node: Node) {
return end
}

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

export function hoistMocks(code: string, id: string, parse: PluginContext['parse']) {
Expand Down
6 changes: 4 additions & 2 deletions test/core/test/injector-mock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,13 @@ console.log(foo + 2)
hoistSimpleCode(`
import { vi } from 'vitest';
1234;
await vi.hoisted(() => {});
await vi
.hoisted(() => {});
`),
).toMatchInlineSnapshot(`
"const { vi } = await import('vitest')
await vi.hoisted(() => {});
await vi
.hoisted(() => {});
1234;"
Expand Down

0 comments on commit c3de3ef

Please sign in to comment.