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

Calls to window.computedStyle(elt, pseudoElt) throws Not implemented errors and makes output very noisy #774

Closed
kertzi opened this issue Oct 2, 2020 · 2 comments

Comments

@kertzi
Copy link

kertzi commented Oct 2, 2020

I'm using testing-library with jest to test react application. After I switched to jsdom-environment-jsdom-sixteen which uses jsdom 16.4.0 I started to get following errors and whole test run output is now flooded with these errors and making spotting actual errors very hard:

Error: Not implemented: window.computedStyle(elt, pseudoElt)
          at module.exports (/home/kertzi/repos/DaisyFamily/.yarn/$$virtual/jsdom-virtual-89425ac844/0/cache/jsdom-npm-16.4.0-2745a1cb43-adca681df0.zip/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
          at Window.getComputedStyle (/home/kertzi/repos/DaisyFamily/.yarn/$$virtual/jsdom-virtual-89425ac844/0/cache/jsdom-npm-16.4.0-2745a1cb43-adca681df0.zip/node_modules/jsdom/lib/jsdom/browser/Window.js:657:7)
          at computeMiscTextAlternative (/home/kertzi/repos/DaisyFamily/.yarn/cache/dom-accessibility-api-npm-0.4.5-c0ff527c7b-c4058ec055.zip/node_modules/dom-accessibility-api/sources/accessible-name.ts:347:24)
          at computeTextAlternative (/home/kertzi/repos/DaisyFamily/.yarn/cache/dom-accessibility-api-npm-0.4.5-c0ff527c7b-c4058ec055.zip/node_modules/dom-accessibility-api/sources/accessible-name.ts:576:11)
          at computeAccessibleName (/home/kertzi/repos/DaisyFamily/.yarn/cache/dom-accessibility-api-npm-0.4.5-c0ff527c7b-c4058ec055.zip/node_modules/dom-accessibility-api/sources/accessible-name.ts:607:3)
          at Array.from.filter.filter.filter.filter.element (/home/kertzi/repos/DaisyFamily/.yarn/cache/@testing-library-dom-npm-7.20.0-a2eae9dc6b-1e6ceb7177.zip/node_modules/@testing-library/dom/dist/queries/role.js:96:82)
          at Array.filter (<anonymous>)
          at queryAllByRole (/home/kertzi/repos/DaisyFamily/.yarn/cache/@testing-library-dom-npm-7.20.0-a2eae9dc6b-1e6ceb7177.zip/node_modules/@testing-library/dom/dist/queries/role.js:90:6)
          at args (/home/kertzi/repos/DaisyFamily/.yarn/cache/@testing-library-dom-npm-7.20.0-a2eae9dc6b-1e6ceb7177.zip/node_modules/@testing-library/dom/dist/query-helpers.js:89:17)
          at args (/home/kertzi/repos/DaisyFamily/.yarn/cache/@testing-library-dom-npm-7.20.0-a2eae9dc6b-1e6ceb7177.zip/node_modules/@testing-library/dom/dist/query-helpers.js:64:17) undefined

Errors doesn't disappear when i try to set computedStyleSupportsPseudoElements: false with configure function.
This is related to change in jsdom 16.4.0: jsdom/jsdom#2918

There also discussion on jsdom repo about this and if I understood jsdom developers correctly this should be fixed on caller side.
jsdom/jsdom#3025

testing-library/react: 10.4.5
testing-library/dom: 7.20.0
jest: 24.9.0
react: 16.13.1

$ yarn why jsdom
├─ jest-environment-jsdom-fourteen@npm:1.0.1
│  └─ jsdom@npm:14.1.0 (via npm:^14.1.0)
│
├─ jest-environment-jsdom-sixteen@npm:1.0.3
│  └─ jsdom@npm:16.4.0 [252d9] (via npm:^16.2.1 [252d9])
│
└─ jest-environment-jsdom@npm:24.9.0
   └─ jsdom@npm:11.12.0 (via npm:^11.5.1)

Configuration:

import { configure } from '@testing-library/react';
import Adapter from 'enzyme-adapter-react-16';

enzymeConfigure({ adapter: new Adapter() });
configure({
  computedStyleSupportsPseudoElements: false
})

Suggested solution from jsdom developers seems to not call computedStyle with pseudoElt parameters.

Maybe there is some bug in configure function because setting computedStyleSupportsPseudoElements to false doesn't fix the problem. Docs says that it should.

I don't have enough skills and time to create fix myself even don't know how to.

Thanks

@eps1lon
Copy link
Member

eps1lon commented Oct 2, 2020

testing-library/dom: 7.20.0

If you upgrade to 7.22.1 you should no longer see a warning. Please also take a look at the documentation for the computedStyleSupportsPseudoElements option if you also run your tests in a real browser.

@kertzi
Copy link
Author

kertzi commented Oct 2, 2020

testing-library/dom: 7.20.0

If you upgrade to 7.22.1 you should no longer see a warning. Please also take a look at the documentation for the computedStyleSupportsPseudoElements option if you also run your tests in a real browser.

Thank you! That fixes the problem.

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

No branches or pull requests

2 participants