diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index 4a9e597151a4..fc72f9a3ade9 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -94,6 +94,18 @@ export async function VitestPlugin( alias: testConfig.alias, conditions: ['node'], }, + // eslint-disable-next-line ts/ban-ts-comment + // @ts-ignore Vite 6 compat + environments: { + ssr: { + resolve: { + // by default Vite resolves `module` field, which not always a native ESM module + // setting this option can bypass that and fallback to cjs version + mainFields: [], + conditions: ['node'], + }, + }, + }, server: { ...testConfig.api, open, diff --git a/packages/vitest/src/node/plugins/workspace.ts b/packages/vitest/src/node/plugins/workspace.ts index bdffdbe16117..491b9200afe5 100644 --- a/packages/vitest/src/node/plugins/workspace.ts +++ b/packages/vitest/src/node/plugins/workspace.ts @@ -71,6 +71,18 @@ export function WorkspaceVitestPlugin( alias: testConfig.alias, conditions: ['node'], }, + // eslint-disable-next-line ts/ban-ts-comment + // @ts-ignore Vite 6 compat + environments: { + ssr: { + resolve: { + // by default Vite resolves `module` field, which not always a native ESM module + // setting this option can bypass that and fallback to cjs version + mainFields: [], + conditions: ['node'], + }, + }, + }, esbuild: viteConfig.esbuild === false ? false : { diff --git a/test/core/test/immutable.test.ts b/test/core/test/immutable.test.ts index 555447c915be..d00e8efa74f6 100644 --- a/test/core/test/immutable.test.ts +++ b/test/core/test/immutable.test.ts @@ -1,13 +1,9 @@ -// import im from 'immutable' -// import { expect, test } from 'vitest' +import im from 'immutable' +import { expect, test } from 'vitest' -// test('basic', () => { -// expect(im.List([{ x: 1 }])).toEqual(im.List([{ x: 1 }])) -// expect(im.List([{ x: 1 }])).toEqual(im.List([1]).map(i => ({ x: i }))) -// expect(im.List([{ x: 1 }])).not.toEqual(im.List([{ x: 2 }])) -// expect(im.List([{ x: 1 }])).not.toEqual(im.List([])) -// }) - -import { test } from 'vitest' - -test('todo', () => {}) +test('basic', () => { + expect(im.List([{ x: 1 }])).toEqual(im.List([{ x: 1 }])) + expect(im.List([{ x: 1 }])).toEqual(im.List([1]).map(i => ({ x: i }))) + expect(im.List([{ x: 1 }])).not.toEqual(im.List([{ x: 2 }])) + expect(im.List([{ x: 1 }])).not.toEqual(im.List([])) +})