We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// environment: 'happy-dom' console.log(CSS); // { escape: [Function: cssEscape] } expect(CSS.escape).toBeDefined(); // ok expect(CSS.supports).toBeDefined(); // not ok
becuase happy-dom depends css.escape, it will change global.CSS to { escape: cssEscape } when import it
css.escape
https://github.com/mathiasbynens/CSS.escape/blob/master/css.escape.js#L97-L101
https://stackblitz.com/edit/vitest-dev-vitest-12tbkc?file=vite.config.ts,test%2Fsuite.test.ts,test%2Fbasic.test.ts&initialPath=__vitest__/
System: OS: macOS 13.2 CPU: (8) arm64 Apple M1 Memory: 155.31 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 20.9.0 - ~/Library/Caches/fnm_multishells/15709_1700617114296/bin/node npm: 10.1.0 - ~/Library/Caches/fnm_multishells/15709_1700617114296/bin/npm pnpm: 8.10.5 - ~/Library/Caches/fnm_multishells/15709_1700617114296/bin/pnpm bun: 1.0.0 - ~/.bun/bin/bun Browsers: Chrome: 119.0.6045.159 Edge: 116.0.1938.76 Safari: 16.3 Safari Technology Preview: 16.4 npmPackages: @vitest/coverage-v8: 1.0.0-beta.4 => 1.0.0-beta.4 vitest: 1.0.0-beta.4 => 1.0.0-beta.4
pnpm
The text was updated successfully, but these errors were encountered:
If happy-dom doesn't provide a global variable, open an issue in happy-dom repository.
Sorry, something went wrong.
happy-dom provide the global variable: CSS but vitest populateGlobal lost it @sheremet-va
https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/env/happy-dom.ts#L50C33-L50C47 win.CSS ok, but global.CSS { escape: [Function: cssEscape] }
getWindowKeys https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/env/utils.ts#L10
i solved by pnpm patch
global.CSS = win.CSS; const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
You are right, sorry for closing the issue.
Successfully merging a pull request may close this issue.
Describe the bug
becuase happy-dom depends
css.escape
, it will change global.CSS to { escape: cssEscape } when import ithttps://github.com/mathiasbynens/CSS.escape/blob/master/css.escape.js#L97-L101
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-12tbkc?file=vite.config.ts,test%2Fsuite.test.ts,test%2Fbasic.test.ts&initialPath=__vitest__/
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: