How to set BASE_URL environment variable in dockerized integration tests? #5695
-
I'm using dockerized Nest.js application with integration tests written with Vitest. After upgrade of all the packages to the latest versions I face an issue I don't understand how to solve. My packages versions are:
The issue I have is Massive abuse of console.log() shows that during vitest's global setup, So it seems like Vite resets existing value of import { defineConfig, UserConfigExport } from 'vitest/config'
export default (): UserConfigExport => {
return defineConfig({
base: 'http://localhost', // <= I set new value for BASE_URL here.
})
} But that literally didn't change anything. So my question is: (best scenario) how do I force Vite to read existing value of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This seems like an unfortunate side effect from Vite. It looks like I can still overwrite it from export default defineConfig({
test: {
env: {
BASE_URL: process.env['BASE_URL'] ?? 'hello!',
},
},
}); It's certainly inconvenient but this |
Beta Was this translation helpful? Give feedback.
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
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.