question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make `@testing-library/dom` a peer dependency instead

See original GitHub issue

@testing-library/angular provides queries straight from @testing-library/dom except that it’s always a locked version. Meaning that one cannot receive any bug fixes and enhancements related to queries without also updating both @testing-library/angular and @angular/core itself.

People who are on Angular 8, for example cannot have these critical fixes without upgrading to Angular 9 at the very least (which isn’t always an option):

Making @testing-library/dom a peer dep will give people a lot of wiggle room to what can be achieved as they see fit as opposed to being locked down.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
zikaaricommented, Jul 23, 2020

No mate it doesn’t work:

image

TypeError: testing.TestBed.inject is not a function

      at Object.<anonymous> (projects/testing-library/src/lib/testing-library.ts:124:33)
      at step (node_modules/tslib/tslib.es6.js:100:23)
      at Object.next (node_modules/tslib/tslib.es6.js:81:53)
      at fulfilled (node_modules/@testing-library/angular/bundles/testing-library-angular.umd.js:329:32)
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:391:26)
      at ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:129:39)
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:390:52)
      at Zone.run (node_modules/zone.js/dist/zone.js:150:43)
      at node_modules/zone.js/dist/zone.js:910:34
      at ZoneDelegate.invokeTask (node_modules/zone.js/dist/zone.js:423:31)
      at ProxyZoneSpec.onInvokeTask (node_modules/zone.js/dist/proxy.js:160:39)
      at ZoneDelegate.invokeTask (node_modules/zone.js/dist/zone.js:422:60)
      at Zone.runTask (node_modules/zone.js/dist/zone.js:195:47)
      at drainMicroTaskQueue (node_modules/zone.js/dist/zone.js:601:35)
1reaction
timdeschryvercommented, Jul 9, 2020

The other packages use a peer dependency to the framework, so I guess we should do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

testing-library/dom should be a peer dependency · Issue #1103
Suggested solution: Make all packages use the same instance of @testing-library/dom by making it a peer dependency of @testing-library ...
Read more >
How to make your npm package. Implement your library
import TestLib from 'react-testing-library-wrapper/dist';. The “peerDependencies” is used when your library depends on an external library.
Read more >
create-react-app dependency version issues with React 18
Could not resolve dependency: npm ERR! peer react@"<18.0.0" from @testing-library/react@12.1.5 npm ERR! node_modules/@testing-library/react ...
Read more >
react warning > @testing-library/user-event@13.5.0 ... - You.com
A peer dependency should be installed by yourself. Usually, the purpose is to prevent version conflicts. So, when you read a message such...
Read more >
Understanding Peer Dependencies in JavaScript
Peer dependencies are almost like normal dependencies, but instead of defining a strong requirement between A and B (i.e the project you're ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found