[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix: make exports prop of proxy point to exports object (#1260)

authored by

Yuyao Nie and committed by
GitHub
(May 9, 2022, 9:07 PM +0800) cd4bed5a 030dd61b

+21 -1
+1 -1
packages/vite-node/src/client.ts
··· 168 168 exports.default = value 169 169 }, 170 170 get exports() { 171 - return exports.default 171 + return exports 172 172 }, 173 173 } 174 174
+2
test/core/src/module-cjs.ts
··· 1 + module.exports.a = 1 2 + module.exports.b = 2
+3
test/core/src/module-esm.ts
··· 1 + const c = 1 2 + export default c 3 + export const d = 2
+15
test/core/test/module.test.ts
··· 1 + import { expect, it } from 'vitest' 2 + // eslint-disable-next-line @typescript-eslint/ban-ts-comment 3 + // @ts-expect-error 4 + import { a, b } from '../src/module-cjs' 5 + import c, { d } from '../src/module-esm' 6 + 7 + it('should work when using cjs module', () => { 8 + expect(a).toBe(1) 9 + expect(b).toBe(2) 10 + }) 11 + 12 + it('should work when using esm module', () => { 13 + expect(c).toBe(1) 14 + expect(d).toBe(2) 15 + })