-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser mode hanging on blank white screen, failing to load vitest/utils #3124
Comments
Nice finding, I'm tracking it in #3100! I guess it's related, since it has the same issue with vitest/utils. |
@Aslemammad Thanks for taking a look at this. I'm still getting the same error though with the latest 0.30.0 version of vitest browser.
Reproduction: https://github.com/ludwigbacklund/vitest-browser-bug-repro |
@ludwigbacklund Could you create another issue for this? |
It's fine to do in the same issue. |
Just to avoid confusion, I'm at Are we still tracking the original issue?
|
It's weird because it was resolved for me, I need to check it again soon. Thank you so much. |
@ludwigbacklund can you try adding this to your Vite config file? optimizeDeps: {
exclude: ['vitest/utils'],
include: ['@vitest/utils', 'vitest/browser'],
}, https://github.com/userquin/vitest-browser-vue (not working with Vite 4.3 beta 5, I need to review the dependencies) |
Updated repo adding vite-4.3 branch using Vite 4.3.0 beta 5 |
Thanks @userquin for inspecting the issue 🙏🏻 @ludwigbacklund After adding below tests are runnig: optimizeDeps: {
exclude: ['vitest/utils'],
include: ['@vitest/utils', 'vitest/browser'],
}, However, I'm getting unexpected errors like when I runt he test in browser (without browser mode all tests are passing) mode with above config, I guess this will get resolved along when we resolve this. Anyways, @userquin's code snippet does makes tests run, Thanks 😇 |
@jd-solanki I've it working on my local using a hack via vite-plugin-vue-type-imports plugin:
import VueTypeImports from 'vite-plugin-vue-type-imports'
const vueTypes = VueTypeImports()
plugins: [
{
name: 'fix-vue-sfc',
enforce: 'pre',
apply: (_, env) => env.mode === 'test',
async resolveConfig(config) {
await (vueTypes as any).resolveConfig(config)
},
async transform(code, id) {
if (!/\.vue(\?.*)?$/.test(id))
return
return await (vueTypes as any).transform(code, id.slice(0, id.lastIndexOf('?')))
},
},
VueMacros({...}),
...
], |
@jd-solanki there is no need to include the hack, VueMacros({
betterDefine: {
include: [/\.vue(\?v=\d+)?$/],
},
...
}) |
@ludwigbacklund with your repo I'm getting this error when running the tests (installing vite 4.2.1 and latest vite react plugin): |
The exclude-include fix got me past the blank screen, but none of my tests run. Depending on the browser and provider, it either loads forever or just claims there are zero tests. I've tried changing the glob pattern and file names. Testing in node works fine. |
This worked for me |
After excluding
Looks like the CommonJS version of pretty-format gets loaded in the browser so it's unable to detect the export. I was able to fix this by installing Now I'm getting the error (even after wiping and reinstalling
|
The problem is not fixed for me after upgrading to v31. Has the issue resolved for anyone else? |
Just adding |
Describe the bug
When trying to run a test in browser mode (playwright) with a basic example next.js application, the browser window opens but hangs on a blank screen and fails to load vitest/utils in the background.
Reproduction
Reproduction repository, based on vitest next.js example: https://github.com/ludwigbacklund/vitest-browser-bug-repro
Just run
yarn test
, it will open a browser window and hang on a white screen. Check the console/network log.System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: