Skip to content

Commit

Permalink
Revert "fix: re-apply default conditions if using vite 6 or later (#7071
Browse files Browse the repository at this point in the history
)" (#7271)
  • Loading branch information
sheremet-va authored Jan 16, 2025
1 parent 74fe67c commit 755ecdf
Show file tree
Hide file tree
Showing 13 changed files with 4 additions and 83 deletions.
16 changes: 0 additions & 16 deletions packages/vitest/src/node/plugins/conditions.ts

This file was deleted.

7 changes: 2 additions & 5 deletions packages/vitest/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { generateScopedClassName } from '../../integrations/css/css-modules'
import { resolveApiServerConfig } from '../config/resolveConfig'
import { Vitest } from '../core'
import { createViteLogger, silenceImportViteIgnoreWarning } from '../viteLogger'
import { getDefaultServerConditions } from './conditions'
import { CoverageTransform } from './coverageTransform'
import { CSSEnablerPlugin } from './cssEnabler'
import { MocksPlugins } from './mocks'
Expand Down Expand Up @@ -74,8 +73,6 @@ export async function VitestPlugin(
open = testConfig.uiBase ?? '/__vitest__/'
}

const conditions = getDefaultServerConditions()

const config: ViteConfig = {
root: viteConfig.test?.root || options.root,
esbuild:
Expand All @@ -93,7 +90,7 @@ export async function VitestPlugin(
// setting this option can bypass that and fallback to cjs version
mainFields: [],
alias: testConfig.alias,
conditions,
conditions: ['node'],
},
server: {
...testConfig.api,
Expand Down Expand Up @@ -122,7 +119,7 @@ export async function VitestPlugin(
// 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,
conditions: ['node'],
},
},
},
Expand Down
7 changes: 2 additions & 5 deletions packages/vitest/src/node/plugins/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { basename, dirname, relative, resolve } from 'pathe'
import { configDefaults } from '../../defaults'
import { generateScopedClassName } from '../../integrations/css/css-modules'
import { createViteLogger, silenceImportViteIgnoreWarning } from '../viteLogger'
import { getDefaultServerConditions } from './conditions'
import { CoverageTransform } from './coverageTransform'
import { CSSEnablerPlugin } from './cssEnabler'
import { MocksPlugins } from './mocks'
Expand Down Expand Up @@ -63,16 +62,14 @@ export function WorkspaceVitestPlugin(
}
}

const conditions = getDefaultServerConditions()

const config: ViteConfig = {
root,
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: [],
alias: testConfig.alias,
conditions,
conditions: ['node'],
},
esbuild: viteConfig.esbuild === false
? false
Expand Down Expand Up @@ -107,7 +104,7 @@ export function WorkspaceVitestPlugin(
// 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,
conditions: ['node'],
},
},
},
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/config/deps/test-dep-conditions/default.js

This file was deleted.

1 change: 0 additions & 1 deletion test/config/deps/test-dep-conditions/module.js

This file was deleted.

1 change: 0 additions & 1 deletion test/config/deps/test-dep-conditions/node.js

This file was deleted.

12 changes: 0 additions & 12 deletions test/config/deps/test-dep-conditions/package.json

This file was deleted.

1 change: 0 additions & 1 deletion test/config/fixtures/conditions-subpackage/module.js

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions test/config/fixtures/default-conditions/vitest.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"test": "vitest --typecheck.enabled"
},
"devDependencies": {
"@vitest/test-dep-conditions": "file:./deps/test-dep-conditions",
"tinyexec": "^0.3.2",
"vite": "latest",
"vitest": "workspace:*"
Expand Down
23 changes: 0 additions & 23 deletions test/config/test/default-conditions.test.ts

This file was deleted.

0 comments on commit 755ecdf

Please sign in to comment.