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

Jsdom does not properly simulate the browser environment #3770

Closed
6 tasks done
UnrilWever opened this issue Jul 14, 2023 · 5 comments
Closed
6 tasks done

Jsdom does not properly simulate the browser environment #3770

UnrilWever opened this issue Jul 14, 2023 · 5 comments

Comments

@UnrilWever
Copy link

Describe the bug

image
when use Object.prototype.toString to get the type of window and process.
The result:
image
but in the real browser environment,it sound be window and undefined.
It's there any methods to handle this problem right now?

Reproduction

demo:https://stackblitz.com/edit/vitest-dev-vitest-iyikma?file=test%2Fexample.test.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.6.3 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 0.33.0 
    vite: latest => 4.4.3 
    vitest: latest => 0.33.0

Used Package Manager

npm

Validations

@stackblitz
Copy link

stackblitz bot commented Jul 14, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

We have to provide process, otherwise most pf the dependencies don't work

@UnrilWever
Copy link
Author

UnrilWever commented Jul 14, 2023

We have to provide process, otherwise most pf the dependencies don't work

understood,but how do i test the func to get the actual browser environment

@sheremet-va
Copy link
Member

We have to provide process, otherwise most pf the dependencies don't work

understood,but how do i test the func to get the actual browser environment

Run tests in the browser 😄

Vitest has experimental support: https://vitest.dev/guide/browser.html

@UnrilWever
Copy link
Author

We have to provide process, otherwise most pf the dependencies don't work

understood,but how do i test the func to get the actual browser environment

Run tests in the browser 😄

Vitest has experimental support: https://vitest.dev/guide/browser.html

OK,thanks,i will try it

@sheremet-va sheremet-va closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants