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

Fix intermittent test failures #1650

Merged
merged 1 commit into from Jan 21, 2019

Conversation

gregtatum
Copy link
Member

I verified this by running: while jest; do :; done from my terminal. I could consistently hit the intermittent after a minute or so of running that. If jest isn't on your path, while yarn test; do :; done should work.

Here is the error message:

  ● app/Home › renders the usage instructions for pages with the extension installed

    TypeError: Cannot read property 'target' of undefined

      41 |         }
      42 |       });
    > 43 |
         | ^
      44 |     const fs = require('fs');
      45 |     const zlib = require('zlib');
      46 |     const buffer = fs.readFileSync('src/test/fixtures/upgrades/test.chrome.gz');

      at getEventTarget (node_modules/react-dom/cjs/react-dom.development.js:2402:28)
      at dispatchEvent (node_modules/react-dom/cjs/react-dom.development.js:3406:27)
      at HTMLImageElement.jest.spyOn.mockImplementation (src/test/unit/profile-conversion.test.js:43:9)
      at Object.listen (node_modules/fbjs/lib/EventListener.js:29:14)
      at trapBubbledEvent (node_modules/react-dom/cjs/react-dom.development.js:3381:24)
      at setInitialProperties$1 (node_modules/react-dom/cjs/react-dom.development.js:13938:7)
      at finalizeInitialChildren (node_modules/react-dom/cjs/react-dom.development.js:14989:5)
      at completeWork (node_modules/react-dom/cjs/react-dom.development.js:8648:19)
      at completeUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:10132:18)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:10234:14)
      at workLoop (node_modules/react-dom/cjs/react-dom.development.js:10288:26)
      at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:542:14)
      at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
      at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
      at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
      at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
      at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
      at Object.invokeGuardedCallbackDev (node_modules/react-dom/cjs/react-dom.development.js:581:16)
      at invokeGuardedCallback (node_modules/react-dom/cjs/react-dom.development.js:438:27)
      at renderRoot (node_modules/react-dom/cjs/react-dom.development.js:10366:7)
      at performWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:11014:24)
      at performWork (node_modules/react-dom/cjs/react-dom.development.js:10967:7)
      at requestWork (node_modules/react-dom/cjs/react-dom.development.js:10878:7)
      at scheduleWorkImpl (node_modules/react-dom/cjs/react-dom.development.js:10732:11)
      at scheduleWork (node_modules/react-dom/cjs/react-dom.development.js:10689:12)
      at scheduleTopLevelUpdate (node_modules/react-dom/cjs/react-dom.development.js:11193:5)
      at Object.updateContainer (node_modules/react-dom/cjs/react-dom.development.js:11231:7)
      at node_modules/react-dom/cjs/react-dom.development.js:15226:19
      at Object.unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:11102:12)
      at renderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:15225:17)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:15290:12)
      at render (node_modules/react-testing-library/dist/index.js:51:21)
      at Object.it (src/test/components/Home.test.js:68:41)

I think resetMocks is having some issues in jest, and for some reason the mock is outliving itself. Perhaps upgrading jest will help here? Otherwise this fixes it for now.

@codecov
Copy link

codecov bot commented Jan 18, 2019

Codecov Report

Merging #1650 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1650   +/-   ##
======================================
  Coverage    81.8%   81.8%           
======================================
  Files         174     174           
  Lines       11743   11743           
  Branches     2842    2845    +3     
======================================
  Hits         9606    9606           
  Misses       1943    1943           
  Partials      194     194

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a2c134...5546ad2. Read the comment docs.

@codecov
Copy link

codecov bot commented Jan 18, 2019

Codecov Report

Merging #1650 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1650   +/-   ##
======================================
  Coverage    81.8%   81.8%           
======================================
  Files         174     174           
  Lines       11743   11743           
  Branches     2842    2845    +3     
======================================
  Hits         9606    9606           
  Misses       1943    1943           
  Partials      194     194

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a2c134...e1d4a7e. Read the comment docs.

Copy link
Contributor

@mstange mstange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this fixes it, but if it does, let's take it. The patch isn't doing anything wrong. It's just doing something that should be unnecessary.

@julienw
Copy link
Contributor

julienw commented Jan 19, 2019

FTR I tried upgrading jest + jsdom and this didn't fix the error.

@julienw
Copy link
Contributor

julienw commented Jan 19, 2019

I filed jestjs/jest#7654 and while doing this I noticed that with these changes I don't get my problem again: https://github.com/julienw/testcase-jest1/compare/reset-mocks

I haven't tried in perf.html yet but this may be a good solution.

@gregtatum gregtatum merged commit 83afe27 into firefox-devtools:master Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants