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
test: suite for expected global object behaviour #67
Conversation
01ba581
to
361f2bf
Compare
@toomuchdesign added some more tests for the problematic behaviour regarding module imports (see #64). I think if we are somehow able to make these tests pass, it will solve all regarding this. It seems to achieve this we would need to do something like this:
|
|
Brief report after a few attempts of working around ES/
jest.isolateModules relativityI confirm that this issue still occurs and This means that, in order to ensure we get modules isolation, we should wrap all tests in a jest.isolateModules + TypescriptSince we have to use jest.isolateModules(() => {
const { createElement } = require('react');
// createElement: any
}); React multiple instances errorTaking the opposite approach with
From React docs:
The first reason that comes to my mind is In this case a not-very-satisfying-workaround could consist of ensuring it('test description', () => {
jest.resetModules()
const { getPage } = require('next-page-tester');
const { render, screen } = require('@testing-library/react');
}) |
Didn't dive into the problem yet, but there might be some ideas in this issue: jestjs/jest#8987, perhaps jestjs/jest#8987 (comment) could work with the different |
Well, it seems we're going to have |
What kind of change does this PR introduce?
Bug fix, feature, docs update, ...
What is the current behaviour?
You can also link to an open issue here.
What is the new behaviour?
...
Does this PR introduce a breaking change?
What changes might users need to make in their application due to this PR?
Other information:
Please check if the PR fulfills these requirements: