Cannot connect to DB using beforeAll() in Vitest VS Code Extension v0.6.0 but works in v0.4.1 #345
-
In this repo I run some tests in the import { defineConfig} from 'vitest/config'
export default defineConfig ({
test: {
pool: 'forks',
poolOptions: {
forks: {
singleFork: true,
},
threads: {
singleThread: true
}
}
}
}) This works with The code executed in beforeAll() fails with OracleDB related errors:
However, when I move the code from I'm running out of ideas. Is there some configuration that needs to be amended when running single-threaded tests via the VS Code extension 0.6.0? Or is this behaviour a bug? Any help is very much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
It should work the same way it does in a CLI. Unless you have some kind of configuration in a folder? Did you debug what values are passed down? |
Beta Was this translation helpful? Give feedback.
-
Good to know.
I duplicated the configuration for the CLI in the "test": "vitest --pool=forks --poolOptions.forks.singleFork --reporter=verbose --dir ./test", I tried with
Yes looks good. It's quite a simple configuration. |
Beta Was this translation helpful? Give feedback.
-
I had this same issue. I just moved all the "beforeAll" outside of "beforeAll". So in my setup files, I just moved that content in there directly. For instance:
After:
|
Beta Was this translation helpful? Give feedback.
-
@ffMathy thanks for the confirmation. Yes, as mentioned my code also works if I run it as part of the tests, outside of So the workaround is to avoid |
Beta Was this translation helpful? Give feedback.
-
I tried the new extension version v0.8.4. It works now as expected. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Yeah I forgot to report this one during the development of the extension. I actually did detect it, but then due to the workaround, I forgot about it.
It's definitely a bug compared to how it was working before.