Error when testing components with mocha
See original GitHub issueHey guys, I wrote a vue.js project and added some unit tests by using mocha. but everytime I try to test it mocha throws following error:
TypeError: Super expression must either be null or a function
at /builds/artemanufrij/anufrij-monitor/node_modules/prettier/index.js:32893:5
at /builds/artemanufrij/anufrij-monitor/node_modules/prettier/index.js:32913:4
if I comment line 32893 it works as expected.
you can find my project here: https://gitlab.com/artemanufrij/anufrij-monitor
currently it’s not possible to test the project by using CI/CL
If you need more information, let me know it please…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:18 (5 by maintainers)
Top Results From Across the Web
How to resolve "Cannot find module" Error when testing react ...
Turns out it is because we are using webpack in our codebase. So mocha will not work as it should. I needed to...
Read more >Testing React Components with Enzyme and Mocha
Know how to test simple React components using enzyme and Mocha; Understand different aspects of testing front-end applications. The full source ...
Read more >Mocha - the fun, simple, flexible JavaScript test framework
If you use callback-based async tests, Mocha will throw an error if done() is called multiple times. This is handy for catching accidental...
Read more >Setup - Testing Library
When using Mocha in watch mode, the globally registered cleanup is run only the first time after each test. Therefore, subsequent runs will...
Read more >How to test React with Mocha, Chai & Enzyme - Robin Wieruch
Mocha will be used as a test runner, Chai as testing library, and Enzyme for your actual React component tests ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Seems that 14.1 broke this. Temporary workaround:
If you use yarn, just add this section to your package.json:
This makes yarn use version 1.14.0 of the nested dependency.
Make sure to
rm yarn.lock && rm -r node_modules && yarn
afterwards. If you skip this, you might be left with the old state (as was my experience when I tested this).In my case, the error was gone by then.
[Edit] clarified the required changes
Hello, do we have any update on this issue?
The error still occurs using
"mocha": "^6.0.2"
,"mocha-webpack": "^2.0.0-beta.0"
and"@vue/test-utils": "^1.0.0-beta.29"