Open nazarhussain opened 1 month ago
This probably happens because we want to statically replace testing-library's env vars:
But looks like adding process.*
creates an empty process
object globally:
Not sure how to fix this yet.
In our project a deep dependency is looking for process.argv
and that is causing to fail the upgrade to vitest 2.0.x
.
Until it's fixed, is there a workaround you could think of?
Until it's fixed, is there a workaround you could think of?
I don't think this can be fixed soon on Vite side, but you can define process.argv
in defines
:
export default defineConfig({
defines: {
'process.argv': '[]',
}
})
Looks like the previous fix breaks config bundling (esbuild hangs) with headless: false
Until it's fixed, is there a workaround you could think of?
I don't think this can be fixed soon on Vite side, but you can define
process.argv
indefines
:export default defineConfig({ defines: { 'process.argv': '[]', } })
In my case I had to also add one other attribute to process.
{
define: {
"process.argv": "[]",
"process.nextTick": "function noop(){}",
},
}
Describe the bug
The default value for
process.argv
does not match between above mentioned versions, when run with thebrowsers
mode.1.6.0
it's was undefined2.0.x
it is an array with few valuesIf we use
vite-plugin-node-polyfills
to pollyfil theprocess
it had different weird behavior.1.6.0
it's was[]
2.0.x
it is undefinedThe
vite-plugin-node-polyfills
version is same in both cases, so the shims does not change at all.Reproduction
https://stackblitz.com/edit/vitest-2-env-argv https://stackblitz.com/edit/vitest-1-env-argv
System Info
Used Package Manager
yarn
Validations