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.

Error when testing components with mocha

See original GitHub issue

Hey 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:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
tpraxlcommented, Aug 28, 2018

Seems that 14.1 broke this. Temporary workaround:

If you use yarn, just add this section to your package.json:

"resolutions": {
        "prettier": "1.14.0"
    },

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

4reactions
iraklisgcommented, Feb 28, 2019

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"

Read more comments on GitHub >

github_iconTop 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 >

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