Skip to content

Commit

Permalink
test: add failing test case for #6057
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jul 21, 2024
1 parent f68453f commit 4cbdf67
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/core/test/hoisted-simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const globalValue = vi.hoisted(() => {
return 'globalValue'
})

let coverageCounter = 0
const nestedHoist = (coverageCounter++, vi.hoisted(() => {
return `Count is ${coverageCounter}`
}))

afterAll(() => {
// @ts-expect-error not typed global
delete globalThis.someGlobalValue
Expand All @@ -17,3 +22,7 @@ afterAll(() => {
it('imported value is equal to returned from hoisted', () => {
expect(value).toBe(globalValue)
})

it('nesting vi.hoisted doesnt cause syntax errors', () => {
expect(nestedHoist).toBe('Count is 1')
})

0 comments on commit 4cbdf67

Please sign in to comment.