Skip to content

Commit

Permalink
test: add test for vitejs#10430
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Oct 19, 2022
1 parent 4fd49e6 commit c7b9de8
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 17 deletions.
4 changes: 3 additions & 1 deletion playground/config/__tests__/load.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { expect, it } from 'vitest'
it('loadConfigFromFile', async () => {
const { config } = await loadConfigFromFile(
{} as any,
resolve(__dirname, '../packages/entry/vite.config.ts')
resolve(__dirname, '../packages/entry/vite.config.ts'),
resolve(__dirname, '../packages/entry')
)
expect(config).toMatchInlineSnapshot(`
{
Expand All @@ -19,6 +20,7 @@ it('loadConfigFromFile', async () => {
4,
],
],
"moduleCondition": "require condition",
}
`)
})
5 changes: 4 additions & 1 deletion playground/config/packages/entry/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "@vite/test-config-entry"
"name": "@vite/test-config-entry",
"dependencies": {
"@vite/test-config-plugin-module-condition": "link:../plugin-module-condition"
}
}
4 changes: 3 additions & 1 deletion playground/config/packages/entry/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import moduleCondition from '@vite/test-config-plugin-module-condition'
import { array } from '../siblings/foo'

export default {
array
array,
moduleCondition
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'require condition'
2 changes: 2 additions & 0 deletions playground/config/packages/plugin-module-condition/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const str: string
export default str
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 'import condition'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 'module condition'
11 changes: 11 additions & 0 deletions playground/config/packages/plugin-module-condition/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@vite/test-config-plugin-module-condition",
"exports": {
".": {
"types": "./index.d.ts",
"module": "./module.mjs",
"import": "./index.mjs",
"require": "./index.cjs"
}
}
}
21 changes: 7 additions & 14 deletions pnpm-lock.yaml

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

0 comments on commit c7b9de8

Please sign in to comment.