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

Suggestion: add plugin before other plugins #6

Closed
danini-the-panini opened this issue May 8, 2016 · 2 comments
Closed

Suggestion: add plugin before other plugins #6

danini-the-panini opened this issue May 8, 2016 · 2 comments

Comments

@danini-the-panini
Copy link
Contributor

I've come across errors resembling the following:

08 05 2016 22:47:59.218:ERROR [coverage]: TypeError: Cannot read property 'text' of undefined
    at PROJECT_ROOT/node_modules/istanbul/lib/report/html.js:241:45

I have found that placing the istanbul plugin before the other plugins fixes the issue.

Causes Error:

// karma.conf.js
//...
    rollupPreprocessor: {
      rollup: {
        plugins: [
          // ... other plugins
          require("rollup-plugin-babel")(),
          require("rollup-plugin-istanbul")({
            exclude: ["test/**/*.js"]
          })
        ]
      }
    },
//...

Fixes Error:

// karma.conf.js
//...
    rollupPreprocessor: {
      rollup: {
        plugins: [
          require("rollup-plugin-istanbul")({
            exclude: ["test/**/*.js"]
          }),
          // ... other plugins
          require("rollup-plugin-babel")()
        ]
      }
    },
//...

@artberri Perhaps, if you think this is a good idea, the README ought to updated to reflect this?

@artberri
Copy link
Owner

I've merged your PR #5 , so, the readme now reflects it. Thank you and sorry for being so late.

@jlmakes
Copy link

jlmakes commented Dec 29, 2016

I believe this is not fixed, and instead has created another error.

I don't have more than these 2 plugins, so I can speak to their order relative to others... but I have found that having rollup-plugin-istanbul before rollup-plugin-buble causes this error:

29 12 2016 04:13:15.760:ERROR [preprocessor.rollup]:
Failed to process /Users/jlmakes/development/project/test/utils/generic.spec.js

Unexpected token (12:3441) in /Users/jlmakes/development/project/src/utils/generic.js

The error reported by @jellymann appears to be an issue with Istanbul's poor handling of source maps (perhaps in conjunction with babel); see the discussion here:

karma-runner/karma-coverage#157
karma-runner/karma-coverage#167

And in the Istanbul repo:
gotwarlost/istanbul#429

There's even a fork with an alleged fix:
https://github.com/jansoren/istanbul

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

3 participants