dom-testing-library: Regression: "ReferenceError: global is not defined"
@testing-library/domversion: 7.22.6- Testing Framework and version: QUnit 2.11.0
- DOM Environment: Chrome 84.0.4147.135 (via Testem)
Relevant code or config:
import { screen } from "@testing-library/dom";
What you did:
I ran my tests: ember test --server.
What happened:
Tests couldn’t be executed, the following error was thrown:
ReferenceError: global is not defined
at Object../node_modules/pretty-format/build/plugins/AsymmetricMatcher.js (test-support.js:37305)
at __webpack_require__ (test-support.js:18993)
at Object../node_modules/pretty-format/build/index.js (test-support.js:36889)
at __webpack_require__ (test-support.js:18993)
at Module../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js (test-support.js:19861)
at __webpack_require__ (test-support.js:18993)
at Module.callback (test-support.js:19106)
at Module.exports (vendor.js:118)
at Module._reify (vendor.js:155)
at Module.reify (vendor.js:142)
Reproduction:
Problem description:
@testing-library/dom 7.22.3 was working fine.
@testing-library/dom 7.22.6 doesn’t work.
Suggested solution:
I can see there was a bump of pretty-format between 7.22.3 and 7.22.6: https://github.com/testing-library/dom-testing-library/commit/9cbc4280d4eceddc5511c21114455f73cd31d196, perhaps it’s the culprit.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 22 (7 by maintainers)
Commits related to this issue
- jest 가 작동하지 않는 문제를 해결한다 2 - https://github.com/testing-library/dom-testing-library/issues/756 - 위와 같은 이슈가 생기고 있어 문제 해결 — committed to CodeSoom/project-react-4-Hamill210 by deleted user 3 years ago
- jest 가 작동하지 않는 문제를 해결한다 2 - https://github.com/testing-library/dom-testing-library/issues/756 - 위와 같은 이슈가 생기고 있어 문제 해결 — committed to CodeSoom/project-react-4-Hamill210 by deleted user 3 years ago
Adding this dev dep solves the error for me (jest 27)
"jest-environment-jsdom": "~27.0"this is a problem only when running tests with jest 27
Thanks. I see the issue and think I know how to solve it. I just want to get the fix right so that we don’t regress in the future.
pretty-formatcaused us quite some trouble in the past since it’s part of thejeststack which doesn’t work in a browser. So using any package from that stack in a browser is always sketchy because it’s untested. But we do want to use it so that the formatting in our library is familiar.Sorry to comment on closed issue, but I still have the same problem. I’m using
wtrandvite. (So, fully esm and browser environment).This is
wtrconfig. nothing special:This is the stack trace:
@Bulletninja This is still the latest status: