diff --git a/test/core/test/hoisted-simple.test.ts b/test/core/test/hoisted-simple.test.ts index a60759fa634e..d09c7f3ac2b9 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 'Nested hoist' +})) + afterAll(() => { // @ts-expect-error not typed global delete globalThis.someGlobalValue @@ -17,3 +22,8 @@ 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('Nested hoist') + expect(coverageCounter).toBe(1) +})