Skip to content

Commit

Permalink
test: fix SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Apr 18, 2024
1 parent 643bed6 commit d7a0da9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/core/test/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ test('define process and using import.meta.env together', () => {
test('PROD, DEV, SSR should be boolean', () => {
expect(import.meta.env.PROD).toBe(false)
expect(import.meta.env.DEV).toBe(true)
expect(import.meta.env.SSR).toBe(true)
expect(process.env.PROD).toBe('')
expect(process.env.DEV).toBe('1')
expect(process.env.SSR).toBe('1')

// see https://github.com/vitest-dev/vitest/issues/5562
if (process.execArgv.includes('--experimental-vm-modules')) {
expect(import.meta.env.SSR).toBe(false)
expect(process.env.SSR).toBe(undefined)
}
else {
expect(import.meta.env.SSR).toBe(true)
expect(process.env.SSR).toBe('1')
}

import.meta.env.SSR = false
expect(import.meta.env.SSR).toEqual(false)
Expand Down

0 comments on commit d7a0da9

Please sign in to comment.