Skip to content

Commit

Permalink
test: more test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 2, 2024
1 parent 746aed7 commit 0aae189
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions packages/vite/src/node/__tests__/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,12 @@ describe('resolveConfig', () => {
test('ssr config compat', async () => {
const config = await resolveConfig(
{
resolve: {
conditions: ['client1'],
},
ssr: {
resolve: {
conditions: ['test1'],
conditions: ['ssr1'],
},
},
plugins: [
Expand All @@ -374,9 +377,14 @@ test('ssr config compat', async () => {
config() {
return {
environments: {
client: {
resolve: {
conditions: ['client2'],
},
},
ssr: {
resolve: {
conditions: ['test2'],
conditions: ['ssr2'],
},
},
},
Expand All @@ -387,9 +395,27 @@ test('ssr config compat', async () => {
},
'serve',
)
expect(config.ssr.resolve?.conditions).toEqual(['test1', 'test2'])
expect(config.environments.ssr.resolve?.conditions).toEqual([
'test1',
'test2',
])
expect(config.resolve.conditions).toMatchInlineSnapshot(`
[
"client1",
]
`)
expect(config.environments.client.resolve.conditions).toMatchInlineSnapshot(`
[
"client1",
"client2",
]
`)
expect(config.ssr.resolve?.conditions).toMatchInlineSnapshot(`
[
"ssr1",
"ssr2",
]
`)
expect(config.environments.ssr.resolve?.conditions).toMatchInlineSnapshot(`
[
"ssr1",
"ssr2",
]
`)
})

0 comments on commit 0aae189

Please sign in to comment.