Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karma Unit Test Failures: Cannot find 'babel-plugin-instanbul' #1016

Open
LilSebastian5000 opened this issue Jan 14, 2019 · 5 comments
Open

Comments

@LilSebastian5000
Copy link

LilSebastian5000 commented Jan 14, 2019

I'm submitting a bug report

  • Library Version:
    1.0.0-beta.9

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    8.9.0

  • NPM Version:
    6.5.0

  • Browser:
    Chrome / All

  • Language:
    ESNext

  • Loader/bundler:
    Webpack

Current behavior:
Karma tests fail to run with the following error:

Error: Cannot find module 'babel-plugin-istanbul' from 'C:\Users\xxx\Documents\aurelia_cli_2019\cli\aurelia-starter-test'
If you want to resolve "istanbul", use "module:istanbul"

I found this issue: #996 and saw that the latest karma-webpack version is incorrect, so I installed "4.0.0-rc.3" as suggested. This did not fix the issue. I also noticed someone mentioned that the following would need to be added to karma.conf.js, but this also did not fix the issue:

  config.set({
    ...
    coverageIstanbulReporter: {
      ...
      skipFilesWithNoCoverage: true
    },
  })
}
  • What is the expected behavior?

Tests should successfully run

  • What is the motivation / use case for changing the behavior?
    I'm trying to upgrade my aurelia project from webpack 3 to webpack 4, but since the aurelia skeleton isn't up to date, and the aurelia-cli is broken, I don't have a valid setup to reference.
@LilSebastian5000
Copy link
Author

LilSebastian5000 commented Jan 14, 2019

Was able to fix this issue by adding the following to my package.json (NOT included with aurelia-cli):

"babel-plugin-istanbul": "5.1.1"

That got rid of my initial error. From there, I got the same error that was mentioned in #996 , and was able to fix it by adding this to my webpack.conf.js:

node: {fs: 'empty'},

I'm not sure if that has any negative effect on a deployed app in the long-run.

**Note, I did not end up needing "coverageIstanbulReporter" in my karma.conf.js in order to fix this issue.

@3cp
Copy link
Member

3cp commented Jan 14, 2019

The webpack setup comes with both au karma and au jest. Maybe you can use jest for the time being.

@LilSebastian5000
Copy link
Author

LilSebastian5000 commented Jan 14, 2019

The webpack setup comes with both au karma and au jest. Maybe you can use jest for the time being.

Thanks for the suggestion, that may be a good tool to look into in the future!

I'm not quite sure the effort involved in converting an application from Karma to Jest without looking into it further, so I've been trying to stick with what we have for now because we have a large application with a high user base and over 1000 tests run through Karma, so if we can get away with as little changes as possible while upgrading everything, the better off we are.

Luckily seems like those minimal changes I made got it working, hopefully a change will get merged into the next release of aurelia-cli now that I've provided reproducible steps to fix :)

@3cp
Copy link
Member

3cp commented Jan 14, 2019

The cli generated webpack skeleton comes with both commands (au karma and au jest) by default.

Try au jest, if all tests pass, nothing needs to be done for the converting :)

@3cp
Copy link
Member

3cp commented Feb 5, 2019

This should be fixed by reverting #970.

https://github.com/huochunpeng/cli/commit/3c4d0d6bc8b61554a5fc29f57bd5468412123fb6

☝️Can you try update your webpack.config.js and try au karma again?

aliblackwell added a commit to tasmat-trust/hexagons that referenced this issue Aug 25, 2021
aliblackwell added a commit to tasmat-trust/hexagons that referenced this issue Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants