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

Fixes Jest tests when using it with newer versions of jsdom. #346

Merged
merged 1 commit into from
May 5, 2015

Conversation

fabiomcosta
Copy link
Contributor

When updating JSdom to the newer version that is compatible with node, 3.1.2, npm test will throw some errors.

 FAIL  HasteModuleLoader/__tests__/HasteModuleLoader-genMockFromModule-test.js
TypeError: Cannot call method 'appendHtmlToDocument' of undefined
  at setInnerHTML (/Users/fabs/Dev/fb/jest/node_modules/jsdom/lib/jsdom/level1/core.js:48:22)
  at HTMLDocument.inheritFrom.write (/Users/fabs/Dev/fb/jest/node_modules/jsdom/lib/jsdom/level1/core.js:1706:7)
  at Object.exports.jsdom (/Users/fabs/Dev/fb/jest/node_modules/jsdom/lib/jsdom.js:59:7)
  at new JSDomEnvironment (/Users/fabs/Dev/fb/jest/src/JSDomEnvironment.js:32:47)
  at TestRunner.runTest (/Users/fabs/Dev/fb/jest/src/TestRunner.js:322:13)
  at onMessage (/Users/fabs/Dev/fb/jest/src/TestWorker.js:50:25)
  at Socket.<anonymous> (/Users/fabs/Dev/fb/jest/node_modules/node-worker-pool/nodeWorkerUtils.js:39:11)
  at Socket.emit (events.js:95:17)
  at Socket.<anonymous> (_stream_readable.js:765:14)
  at Socket.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:427:10)
  at emitReadable (_stream_readable.js:423:5)
  at readableAddChunk (_stream_readable.js:166:9)
  at Socket.Readable.push (_stream_readable.js:128:10)
  at Pipe.onread (net.js:529:21)

screen shot 2015-04-29 at 10 17 30 pm

require('jsdom') needs to happen before the other jsdom requires because some internal states are setup on that first call, and the second call depend on those.
After this change tests started passing just fine. I also tested with the current jsdom version and everything is fine too.

@DmitrySoshnikov
Copy link
Contributor

@fabiomcosta, which new version of jsdom are you using? We have an issue to update to the newer version, see #221. If it's unrelated, the PR looks good to me. CC @zpao

@fabiomcosta
Copy link
Contributor Author

@DmitrySoshnikov this doesn't actually updates to the newwst JSDOM that supports node (3.1.2) but it makes it work with it. So in the future when this happens we are going to be ready.

@DmitrySoshnikov
Copy link
Contributor

OK, sounds good, thanks!

DmitrySoshnikov added a commit that referenced this pull request May 5, 2015
Fixes Jest tests when using it with newer versions of jsdom.
@DmitrySoshnikov DmitrySoshnikov merged commit 98558bd into jestjs:master May 5, 2015
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants