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

waitFor error "MutationObserver is not a constructor" with latest version #477

Closed
transmissions11 opened this issue Mar 13, 2020 · 25 comments

Comments

@transmissions11
Copy link

transmissions11 commented Mar 13, 2020

  • DOM Testing Library version: Using React Testing Lib Version: ^10.0.0
  • node version: v12.13.1
  • npm (or yarn) version: 6.13.7

Relevant code or config:

await waitFor(() => {
    expect(submitButton).toHaveAttribute("aria-disabled", "false");
  });

What you did:

I'm using the new React-Testing-Library version and trying to fix my tests that use waitFor, but it I am getting a MutationObserver error that is preventing my tests from passing.

I'm using the built in CRA react-scripts test command to run my tests

What happened:

    TypeError: MutationObserver is not a constructor

      146 | 
      147 |   // Wait until the picture is UPLOADED and the disabled attribute is REMOVEaD
    > 148 |   await waitFor(() => {
          |         ^
      149 |     expect(submitButton).toHaveAttribute("aria-disabled", "false");
      150 |   });
      151 | 

      at node_modules/@testing-library/dom/dist/wait-for.js:32:22
      at waitFor (node_modules/@testing-library/dom/dist/wait-for.js:25:10)
      at node_modules/@testing-library/dom/dist/wait-for.js:64:54
      at node_modules/@testing-library/react/dist/pure.js:51:22
      at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:21887:12)
      at act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
      at asyncAct (node_modules/@testing-library/react/dist/act-compat.js:118:12)
      at Object.asyncWrapper (node_modules/@testing-library/react/dist/pure.js:50:35)
      at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:64:35)
      at Object.<anonymous> (src/components/NewSpotForm.test.js:148:9)
@transmissions11
Copy link
Author

This may be an issue with react-scripts having an old version of jsdom (14.1.0)?

@eps1lon
Copy link
Member

eps1lon commented Mar 13, 2020

@TransmissionsDev Please include the exact version of react-scripts or describe your test setup. jsdom 14 should have MutationObserver

@flaviendelangle
Copy link

Same issue here with jsdom 11.5.1I manually installed the last version ofjsdom (16+`) but still had the error.

@eps1lon
Copy link
Member

eps1lon commented Mar 13, 2020

Same issue here with jsdom 11.5.1I manually installed the last version ofjsdom (16+`) but still had the error.

@flaviendelangle On jsdom 11 this is expected. You need to make sure your testing environment is using the proper version. For example in jest you need jest-environment-jsdom-sixteen (or what it's called). This is best asked on spectrum.chat or StackOverflow though.

@bartlomiejzuber
Copy link

Had the same issue(latest CRA) and can confirm that this fixes it:
yarn add jest-environment-jsdom-sixteen --dev

and then set it via env cli param

"scripts": {
   ...
   "test": "react-scripts test --env=jest-environment-jsdom-sixteen",
   ...
}

@kentcdodds
Copy link
Member

kentcdodds commented Mar 13, 2020

Sorry about this trouble. For some reason I thought CRA had the latest Jest. Is there already an issue over there about upgrading?

@eps1lon
Copy link
Member

eps1lon commented Mar 13, 2020

Sorry about this trouble. For some reason I thought CRA had the latest Jest. I'd there already an issue over there about upgrading?

The problem is that latest react-scripts depends on jest@24 not jest@latest (25). jest@24 still uses jsdom@11 by default. MutationObserver got added in jsdom@13

misread it. See facebook/create-react-app#8362

@kentcdodds
Copy link
Member

For folks who don't want to use jest-environment-jsdom-sixteen (for whatever reason), you can also include a MutationObserver shim yourself. I've updated the release notes.

@transmissions11
Copy link
Author

@kentcdodds So the solution here is to get CRA to upgrade their version of Jest? That's unfortunate, I hope we can get some quick progress with them.

@kentcdodds
Copy link
Member

There are three options listed in the release notes. So waiting is not your only option.

@kentcdodds
Copy link
Member

That said there's nothing more we can do in this repository so I'm going to close this issue.

Thank you to everyone here who contributed to the discussion and helped to improve the release notes.

keingsw added a commit to keingsw/auth0-react-integration that referenced this issue Mar 26, 2020
this fixes the error `MutationObserver is not a constructor` for waitFor in `react-testing-library`
testing-library/dom-testing-library#477
facebook-github-bot pushed a commit to facebook/flipper that referenced this issue Apr 1, 2020
…947)

Summary:
Note: I had to add a new Jest environment to get this to run. More context is in testing-library/dom-testing-library#477.

Pull Request resolved: #947

Test Plan: yarn test

Reviewed By: mweststrate

Differential Revision: D20766231

Pulled By: passy

fbshipit-source-id: bd6bf732cae862d84ad5ab66a3e57d5933a030a5
@selena-mallet
Copy link

this fix : #477 (comment)
works also with jest:
"scripts": {
...
"test": "jest --maxWorkers=1 --env=jest-environment-jsdom-sixteen",
...
}

@SandroMiguel
Copy link

In my case updating Jest to v25.4.0 was enough (I'm not using CRA).

@kentr
Copy link

kentr commented May 8, 2020

Putting some notes about this in the docs could save a lot of time & digging.

I got to the testing library from React's Test Utilities page, and then dove into the Testing Library Example, which doesn't work without upgrading @testing-library/react and adding jest-environment-jsdom-sixteen.

I'm happy to contribute to that change if it would help. I'd need some guidance on doc standards & the best place to add it.

@kentcdodds
Copy link
Member

Maybe putting a note about it on this page would be fine: https://testing-library.com/docs/dom-testing-library/api-async

@vadimshvetsov
Copy link

vadimshvetsov commented May 11, 2020

How to make it working in CodeSandbox? There is no window object and workaround with MutationObserver is not applicable. Also setting react-scripts test --env=jest-environment-jsdom-sixteen doesn't help.

https://codesandbox.io/s/field-eokex?file=/src/__tests__/hello.js

poteirard pushed a commit to ZopaPublic/react-components that referenced this issue May 12, 2020
poteirard pushed a commit to ZopaPublic/react-components that referenced this issue May 12, 2020
@kentcdodds
Copy link
Member

It works in codesandbox actually: https://codesandbox.io/s/zen-paper-wdfcu?file=/src/__tests__/index.js:539-595

I'm guessing there's something else wrong with your example.

@vadimshvetsov
Copy link

vadimshvetsov commented May 14, 2020

@kentcdodds thanks, looks like there is a problem within my code or react-hook-form, but can't find out where. I've set a MutationObserver polyfill like in release notes of @testing-library/dom@7, but it doesn't works. Anyway I won't someone to spend a time on it, it's not very important issue, I've got just spyOn console.error to suppress an act warning there

@przemuh
Copy link

przemuh commented May 15, 2020

Maybe it would be helpful for someone...

In my case even updating to the latest jest 26.x didn't solve the problem. That was because we used to use enzyme with jest-enzyme package (we have not migrated all spec to testing-lib yet).

The problem is that the latest jest-enzyme package has dependency on jest-environement-jsdom in old version 24.9.0 🤦

yarn why jest-environment-jsdom
yarn why v1.22.4
[1/4] 🤔  Why do we have the module "jest-environment-jsdom"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "jest-environment-jsdom@24.9.0"
info Reasons this module exists
   - "jest-enzyme#jest-environment-enzyme" depends on it
   - Hoisted from "jest-enzyme#jest-environment-enzyme#jest-environment-jsdom"
info Disk size without dependencies: "1.95MB"
info Disk size with unique dependencies: "8.34MB"
info Disk size with transitive dependencies: "32.69MB"
info Number of shared dependencies: 121
=> Found "jest-config#jest-environment-jsdom@26.0.1"
info This module exists because "jest#@jest#core#jest-config" depends on it.
info Disk size without dependencies: "24KB"
info Disk size with unique dependencies: "6.41MB"
info Disk size with transitive dependencies: "30.77MB"
info Number of shared dependencies: 121
✨  Done in 1.69s.

So...the fix was about setting the proper resolution in package.json

"resolutions": {
     "jest-environment-jsdom": "^26.0.1"
}

@stonecrafter
Copy link

I get this error when running react-scripts test --env=jest-environment-jsdom-sixteen .... anybody else?

Cannot find module '@babel/compat-data/plugin-bugfixes' (While processing: "[path/to/my/project]/node_modules/react-scripts/node_modules/babel-preset-react-app/index.js")

at Object.<anonymous> (node_modules/react-scripts/node_modules/@babel/preset-env/lib/plugins-compat-data.js:10:46)

Haven't found anyone else write about having this issue (or fixing it)

nmkataoka added a commit to nmkataoka/adv-life that referenced this issue Jul 25, 2020
Had to manually upgrade jest-dom in order for react-testing-library
to work properly. React scripts will be upgrading jest-dom soon in
v4.0.0:
testing-library/dom-testing-library#477
cafca added a commit to FixMyBerlin/fixmy.frontend that referenced this issue Aug 18, 2020
* chore: install react testing
library

* test: remove cypress test for faq item expansion

* chore(.eslintrc): get rid of warnings "XX should be listed in the project's dependencies, not devDependencies"

see https://stackoverflow.com/a/44939592

* chore: install @testing-library/jest-dom

* [WIP] test(reports/FaqItem): add first failing test

* test: remove unit test for faq item

react-testing-library is not able to detect that the ancestor element
of the element containing the text has overflow=hidden applied.
Cypress is way smarter here.

https://github.com/testing-library/jest-dom/#tobevisible
https://docs.cypress.io/guides/core-concepts/interacting-with-elements.html#Additionally-an-element-is-considered-hidden-if

* Revert "test: remove cypress test for faq item expansion"

This reverts commit ec9b9c4

* [WIP]test(AutoCompleteGeocoder): add first unit tests

* test(AutoCompleteGeocode): test callbacks for focus and blur

* chore: add msw

https://github.com/mswjs/msw
https://kentcdodds.com/blog/stop-mocking-fetch

* chore: update jest to v25.4.0

testing-library/dom-testing-library#477 (comment)

* test(AutoCompleteGeocoder): [WIP] add more tests

* testing(AutoCompleteGeocoder): almost done (wip)

* test(AutoCompleteGeocoder): refactor unit tests

* test(AutoCompleteGeocoder): fix test for request buffering

* test(AutoCompleteGeocoder): prettify

* test(AutoCompleteGeocoder): sharpen test for locationPick callback

* test(AutoCompleteGeocoder): refactor tests for async input handling

* test(AutoCompleteGeocoder): [WIP]: test onEnter logic

* test(AutoCompleteGeocoder): test error and reset handling

* test(AutoCompleteGeocoder): correctly test enter press when only one suggestion is being displayed

* test(AutoCompleteGeocoder): minor cleanup

* fix broken tests by correctly overriding global fetch during tests

* fix(eslintrc): malconfiguration regarding implicit dependencies

* refactor: prettier

* Replacing globals can make debugging hard

The problem can be solved by importing node-fetch here. Even better
would be to use `ky-universal` but that
would require further refactoring.

* improve(AutoCompleteGeocoder.unit.test): speed up tests by lowering debounceTime

Co-authored-by: Vincent Ahrend <mail@vincentahrend.com>
@neomib
Copy link

neomib commented Sep 14, 2020

For me, it was jest-cli that had an old version of jsdom. So first I run npm ls jsdom and then upgraded the libraries that I saw were using an old version of jsdom.

@jonbwalker
Copy link

For me, it was jest-cli that had an old version of jsdom. So first I run npm ls jsdom and then upgraded the libraries that I saw were using an old version of jsdom.

This worked for me! I had jest v26 installed and jest-junit v5 installed. Even though jest 26 has jsdom 16, it was using the jsdom from jest-junit which had jsdom 11!

updating jest-junit to latest (v11) fixed the issue.

Thanks for the hint @neomib! 💯

Screen Shot 2020-09-23 at 11 26 26 AM

@richardwan
Copy link

richardwan commented Sep 25, 2020

For folks who don't want to use jest-environment-jsdom-sixteen (for whatever reason), you can also include a MutationObserver shim yourself. I've updated the release notes.

which solution did you use in this example? https://github.com/kentcdodds/react-testing-library-examples I cant seem to find a reference to the shim or the jsdom-sixteen in the package.json

it looks like you took a 4th option and upgraded react-scripts https://github.com/kentcdodds/react-testing-library-examples/blob/master/package.json#L26

is this the a new preferred option?

@totaland
Copy link

Hi @kentcdodds,

There seems to be a timeout error when you fire the await waitForElementToBeRemoved twice.

So the app I built has 3 stages when I click on a button I fire that waitForElementToBeRemoved and assert the new layout. This new layout will also has a next button. I click on that button and fire that waitForElementToBeRemoved. This time it didn't work and will have the timeout error for waitForElementToBeRemoved.

How do I fix that?

bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Sep 30, 2020
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 1, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 2, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 5, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review

* load-the-data: initial commit: added LoadTheData.js

* load-the-data: fetching data implemented. But unit test and e2e test filing

* load-the-data: troubleshooting tests

* load-the-data: continue troubleshooting tests

* load-the-data: fix linting error

* load-the-data: fix the code to fetch top 500 posts

* load-the-data: troubleshooting unit test - 'invalid json response body at  reason: Unexpected end of JSON input'

* load-the-data: integration test passing

* load-the-data: refactor code after review. still 1 test to fix in SearchPage.js

* laod-the-data: all tests pass
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 10, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review

* load-the-data: initial commit: added LoadTheData.js

* load-the-data: fetching data implemented. But unit test and e2e test filing

* load-the-data: troubleshooting tests

* load-the-data: continue troubleshooting tests

* load-the-data: fix linting error

* load-the-data: fix the code to fetch top 500 posts

* load-the-data: troubleshooting unit test - 'invalid json response body at  reason: Unexpected end of JSON input'

* load-the-data: integration test passing

* load-the-data: refactor code after review. still 1 test to fix in SearchPage.js

* laod-the-data: all tests pass

* heatmap: first commit: setup heatmap table

* heatmap: implemented heatmap architecture

* heatmap: implemented user timezone

* heatmap: implemented hover, highlit and timezone

* heatmap: completed implementation - start testing

* heatmap: refactor component structure - set test skeleton

* heatmap: complete integration tests

* heatmap: complete. fix user timezone in tests

* heatmap: refactor code after review

* heatmap: fix all test errors. ready to merge pr

* heatmap: fix last test errors. ready to merge pr
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 12, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review

* load-the-data: initial commit: added LoadTheData.js

* load-the-data: fetching data implemented. But unit test and e2e test filing

* load-the-data: troubleshooting tests

* load-the-data: continue troubleshooting tests

* load-the-data: fix linting error

* load-the-data: fix the code to fetch top 500 posts

* load-the-data: troubleshooting unit test - 'invalid json response body at  reason: Unexpected end of JSON input'

* load-the-data: integration test passing

* load-the-data: refactor code after review. still 1 test to fix in SearchPage.js

* laod-the-data: all tests pass

* heatmap: first commit: setup heatmap table

* heatmap: implemented heatmap architecture

* heatmap: implemented user timezone

* heatmap: implemented hover, highlit and timezone

* heatmap: completed implementation - start testing

* heatmap: refactor component structure - set test skeleton

* heatmap: complete integration tests

* heatmap: complete. fix user timezone in tests

* heatmap: refactor code after review

* heatmap: fix all test errors. ready to merge pr

* heatmap: fix last test errors. ready to merge pr

* posts-table: e2e tests passing

* posts-table: 2 integration tests remaining

* posts-table: resolved conflicts

* posts-table: fix lint issue

* posts-table: fix lint issue

* posts-table: implemented posts sorted by time created

* post-table: refactor after review
SpiritBreaker226 added a commit to SpiritBreaker226/hero-orders that referenced this issue Oct 16, 2020
Add `jest-environment-jsdom-sixteen` as Testing Library has to remove
MutationObserver shim since the significant browsers and recent version
of JSDOM support MutationObserver, so there is no need for Testing
Library have their version of MutationObserver. However, `react-scripts`
have not updated to account for the loss of MutationObserver. As a
result, we add in manually until `react-scripts` has updated.

---
Ref:

testing-library/dom-testing-library#477
https://github.com/testing-library/dom-testing-library/releases/tag/v7.0.0
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 17, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review

* load-the-data: initial commit: added LoadTheData.js

* load-the-data: fetching data implemented. But unit test and e2e test filing

* load-the-data: troubleshooting tests

* load-the-data: continue troubleshooting tests

* load-the-data: fix linting error

* load-the-data: fix the code to fetch top 500 posts

* load-the-data: troubleshooting unit test - 'invalid json response body at  reason: Unexpected end of JSON input'

* load-the-data: integration test passing

* load-the-data: refactor code after review. still 1 test to fix in SearchPage.js

* laod-the-data: all tests pass

* heatmap: first commit: setup heatmap table

* heatmap: implemented heatmap architecture

* heatmap: implemented user timezone

* heatmap: implemented hover, highlit and timezone

* heatmap: completed implementation - start testing

* heatmap: refactor component structure - set test skeleton

* heatmap: complete integration tests

* heatmap: complete. fix user timezone in tests

* heatmap: refactor code after review

* heatmap: fix all test errors. ready to merge pr

* heatmap: fix last test errors. ready to merge pr

* posts-table: e2e tests passing

* posts-table: 2 integration tests remaining

* posts-table: resolved conflicts

* posts-table: fix lint issue

* posts-table: fix lint issue

* posts-table: implemented posts sorted by time created

* post-table: refactor after review

* Final refactor: cleaned up tests and set background color to white

* readme: add project readme

* readme: made header menu responsive on mobile device

* readme: made header menu responsive on mobile device: fixe error

* readme: implemented cell with deleted author and cell background colr scheme selection

* readme: implemented postsTable display in modal window
jonotp added a commit to jonotp/invoice that referenced this issue Oct 26, 2020
Needed to install ts-jest to avoid typescript errors when trying to clear mocked implementation. See link below:
kulshekhar/ts-jest#576

Also CRA has outdated jsdom (v14.1.0) which results in MutationObserver error when trying to use WaitFor's in react testing library. Needed to jsdom-sixteen package to run jest with jsdom v16. See the link below
testing-library/dom-testing-library#477
bahobab added a commit to bahobab/reddit-timer-bahobab that referenced this issue Oct 28, 2020
* header task: first commit

* header task: fixed missing default 'javascript'

* header task: fixed default link: '/search/javascript'

* header after first review

* header fixing test

* implemented unit test

* header: before rebase after app-skeleton-review

* resolved conflicts. Fixed unit tests

* footer: initial commit

* implemented Footer.js and Footer.style.js

* footer: completed unit tests

* hero-section: initial commit with with fixes from previous PR

* hero-section: completed unit tests

* hero-section: fixed linting issues in unit tests

* hero-section: fixed Apps to have all unit tests pass

* hero-section: added missing test descriptions in footer.js

* hero-section: refactor components and file structure after review

* info-section: initial commit

* info-section: implemented About and How it works sections

* info-section: fix link to https://ooloo.io/employers

* info-section: implemented react-router-hash-link

* info-section: fixed ooloo.io link

* info-section: implemented unit tests

* info-section: fixed linting errors

* info-section: fixed linting errors

* info-section: fix unit test using this: testing-library/dom-testing-library#477 (comment)

* info-section: commit after review

* subreddit-form: initial commit. Setup folder structure

* subreddit-form: implement tests

* subreddit-form: fix lint error in Header.js

* subreddit-form: completed unit and e2e tests

* subreddit-form: fixes and cleanup after review

* load-the-data: initial commit: added LoadTheData.js

* load-the-data: fetching data implemented. But unit test and e2e test filing

* load-the-data: troubleshooting tests

* load-the-data: continue troubleshooting tests

* load-the-data: fix linting error

* load-the-data: fix the code to fetch top 500 posts

* load-the-data: troubleshooting unit test - 'invalid json response body at  reason: Unexpected end of JSON input'

* load-the-data: integration test passing

* load-the-data: refactor code after review. still 1 test to fix in SearchPage.js

* laod-the-data: all tests pass

* heatmap: first commit: setup heatmap table

* heatmap: implemented heatmap architecture

* heatmap: implemented user timezone

* heatmap: implemented hover, highlit and timezone

* heatmap: completed implementation - start testing

* heatmap: refactor component structure - set test skeleton

* heatmap: complete integration tests

* heatmap: complete. fix user timezone in tests

* heatmap: refactor code after review

* heatmap: fix all test errors. ready to merge pr

* heatmap: fix last test errors. ready to merge pr

* posts-table: e2e tests passing

* posts-table: 2 integration tests remaining

* posts-table: resolved conflicts

* posts-table: fix lint issue

* posts-table: fix lint issue

* posts-table: implemented posts sorted by time created

* post-table: refactor after review

* Final refactor: cleaned up tests and set background color to white

* readme: add project readme

* readme: made header menu responsive on mobile device

* readme: made header menu responsive on mobile device: fixe error

* readme: implemented cell with deleted author and cell background colr scheme selection

* readme: implemented postsTable display in modal window

* pre-deployment: clean up styling - added tootips

* readme: Completed features integration tests

* readme: Completed Cypress e2e tests

* readme: refactor for responsive form and footer. Added to readme

* readme: added to readme

* readme: 2nd push after rebase. clean up and fixes
@ajfranzoia
Copy link

ajfranzoia commented Nov 3, 2020

If you're using Webstom and your tests are still failing, install the package as specified in #477 (comment) and try adding --env=jest-environment-jsdom-sixteen to the Jest run configuration template.

@testing-library testing-library locked as resolved and limited conversation to collaborators Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests