Skip to content
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

Vitest v1.0.0-beta5 browser mode hangs in an infinite reload #4570

Closed
6 tasks done
nicojs opened this issue Nov 22, 2023 · 3 comments · Fixed by #4590
Closed
6 tasks done

Vitest v1.0.0-beta5 browser mode hangs in an infinite reload #4570

nicojs opened this issue Nov 22, 2023 · 3 comments · Fixed by #4590
Labels
feat: browser Issues and PRs related to the browser runner

Comments

@nicojs
Copy link
Contributor

nicojs commented Nov 22, 2023

Describe the bug

When running the beta-5 release of vitest in browser mode, you can get stuck in an infinite loop if you have an older version of pretty-format installed as sibling of vitest. See animated gif:

vitest-infinite-reload

Reproduction

mkdir foo && cd foo
npm init --yes
npm i -D vitest@beta @vitest/browser@beta playwright pretty-format@21
touch vitest.config.js
# import { defineConfig } from 'vitest/config';
# 
# export default defineConfig({
#   test: {
#     globals: true,
#     browser: {
#       enabled: true,
#       name: 'chromium',
#       provider: 'playwright',
#       headless: false,
#     },
#   },
# });

# Add an example project
npx vitest

Or download this zip:
vitest-infinite-reload.zip

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 10.11 GB / 15.49 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.18.0/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
    pnpm: 8.9.2 - ~/.nvm/versions/node/v18.18.0/bin/pnpm
  Browsers:
    Chrome: 118.0.5993.117
  npmPackages:
    @vitest/browser: ^1.0.0-beta.5 => 1.0.0-beta.5
    vitest: ^1.0.0-beta.5 => 1.0.0-beta.5

Used Package Manager

npm

Validations

@beamery-tomht
Copy link

beamery-tomht commented Nov 28, 2023

I'm getting this issue on all versions from beta.1 to beta.5 and have the latest version of "pretty-format" in my resolutions. Are you sure this is the cause?

↪ yarn why pretty-format                                                                                                                                                                                            3875ms ~ 16:23:41 ~ 28 Nov
yarn why v1.22.19
[1/4] 🤔  Why do we have the module "pretty-format"...?
[2/4] 🚚  Initialising dependency graph...
warning Resolution field "pretty-format@29.7.0" is incompatible with requested version "pretty-format@^27.0.2"
warning Resolution field "pretty-format@29.7.0" is incompatible with requested version "pretty-format@29.4.3"
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "pretty-format@29.7.0"
info Reasons this module exists
   - "_project_#@types#jest" depends on it
   - Hoisted from "_project_#@types#jest#pretty-format"
   - Hoisted from "_project_#jest-matcher-utils#pretty-format"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#pretty-format"
   - Hoisted from "_project_#@testing-library#react#@testing-library#dom#pretty-format"
   - Hoisted from "_project_#jest-axe#jest-matcher-utils#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#pretty-format"
   - Hoisted from "_project_#jest-matcher-utils#jest-diff#pretty-format"
   - Hoisted from "_project_#@jacuzzi#vacancy#vitest#@vitest#snapshot#pretty-format"
   - Hoisted from "_project_#@jacuzzi#vacancy#vitest#@vitest#utils#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-config#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-message-util#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-snapshot#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-validate#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-config#jest-circus#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-runner#jest-leak-detector#pretty-format"
   - Hoisted from "_project_#jest#@jest#core#jest-config#jest-circus#jest-each#pretty-format"
info Disk size without dependencies: "188KB"
info Disk size with unique dependencies: "296KB"
info Disk size with transitive dependencies: "916KB"
info Number of shared dependencies: 5
✨  Done in 0.38s.

vitest-reloads

yarn workspace @scope/package vitest --browser.enabled --browser.name chrome
// package/vitest.config.ts
import { defineConfig } from 'vitest/config';

// eslint-disable-next-line import/no-default-export
export default defineConfig({
  test: {
    include: ['test/specs/path/some-spec.spec.{ts,tsx}'],
  },
});

@sheremet-va
Copy link
Member

@beamery-tomht what about v1.0.0-beta.6?

@beamery-tomht
Copy link

Yes, just checked and still happening. I've reverted back to 0.34.6 as the bug with tests hanging sometimes is less of a blocker than the tests not working at all 😿

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: browser Issues and PRs related to the browser runner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants