diff --git a/test/core/test/hoisted-simple.test.ts b/test/core/test/hoisted-simple.test.ts index a60759fa634e..dc3aa349251a 100644 --- a/test/core/test/hoisted-simple.test.ts +++ b/test/core/test/hoisted-simple.test.ts @@ -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 @@ -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') +})