NYC/Istanbul with .vue Vue components

Viewed 1241

Does NYC/Istanbul code reporting tool ignore template and style tags within a VueJS component file (with the extension .vue). Is nyc smart enough to do that?

1 Answers

Yes, it is possible @light24bulbs! I've made nyc + Vue + Mocha work here.

I've failed some times before making it work, thought. The thing that made the trick was to manually select the defaults while (re)creating the project with vue-cli. Vue-cli has proven to be much better than me configuring webpack.

$ node --version
v10.16.0

$ vue --version
3.11.0


 //package.json
  ...
  "scripts": {
    ...
    "test": "nyc vue-cli-service test:unit"
  },
  "nyc": {
    "extension": [
      ".js",
      ".vue"
    ]
  },
  "devDependencies": {
    "nyc": "^14.1.1",
  ...

sample

Related