prettier: Error when testing components with mocha

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…

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 18 (5 by maintainers)

Commits related to this issue

Most upvoted comments

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

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"

FWIW Just want the maintainers to know that workarounds are being spread throughout the JS community that boil down to pinning prettier to 1.13.*

@hawkrives I am not loading it in my test suite vue loads it and thats what i am testing.

@hawkrives they aren’t loading

vue-loader depends on prettier, that is why it is getting loaded.