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.

[testing] register chai plugins type error

See original GitHub issue

Hi!

Since the last minor version 2.3.0, where there is an update of using chai plugins, it throws an error whenever you try to execute the tests with npm run test command.

This is the error I mention:

TypeError: Cannot read property 'use' of undefined at Module../node_modules/@open-wc/testing/register-chai-plugins.js (http://localhost:9876/absoluteC:/Users/AppData/Local/Temp/_karma_webpack_/commons.js?75a6c001bc3dabe4571a9762f775846886fba511:27698:13) at __webpack_require__ (http://localhost:9876/absoluteC:/Users/AppData/Local/Temp/_karma_webpack_/runtime.js?c38d51cd4af62e9eacd04bb5dfbfbac27880397b:85:30) at Module../node_modules/@open-wc/testing/index.js

I do not know if there is any config missing I have to include due to this update, but it is failing when it tries to use those plugins as window.chai seems not to be registered well.

This is the line I mention in register-chai-plugins.js file: window.chai.use(chaiDomDiff);

Thanks in advance!!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
daKmoRcommented, Aug 22, 2019

if you are using karma-webpack you can try to add chai/chai.js to your files in the karma.conf.js

files: [
  { pattern: require.resolve('chai/chai.js' }, 
  // other files
]

if that solves your problem would you be willing to add this information to our documentation via a PR? 🤗

0reactions
stale[bot]commented, Oct 14, 2019

Hey there, it’s me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Open Web Components!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mocha - Chai requires plugins globally - Stack Overflow
Plugins are registered with the use function from chai . Using chai-as-promised for example: import { expect, use } from 'chai' import ...
Read more >
Assertion Styles - Chai
This section of the guide introduces you to the three different assertion styles that you may use in your testing environment.
Read more >
chai | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
chaijs/chai - Gitter
Hello , I register the chai module in my wdio.conf.js file ... In my test file I write: ... Error: write EPROTO 139638903605056:error:14094410:SSL ......
Read more >
Chai - npm
BDD/TDD assertion library for node.js and the browser. Test framework agnostic.. Latest version: 4.3.7, last published: 2 months ago.
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