Skip to content

How to set BASE_URL environment variable in dockerized integration tests? #5695

Answered by hi-ogawa
Kolobamanacas asked this question in Q&A
Discussion options

You must be logged in to vote

This seems like an unfortunate side effect from Vite. It looks like I can still overwrite it from test.env config. How about something like this?
https://stackblitz.com/edit/vitest-dev-vitest-f5v5k7?file=vite.config.ts

export default defineConfig({
  test: {
    env: {
      BASE_URL: process.env['BASE_URL'] ?? 'hello!',
    },
  },
});

It's certainly inconvenient but this BASE_URL convention seems deeply tied to Vite, so I'm not sure how much Vitest can manipulate that without breaking something.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kolobamanacas
Comment options

Answer selected by Kolobamanacas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants