cypress-io / cypress-vue-unit-test

A little helper to unit test Vue components in the Cypress.io E2E test runner
294 stars 23 forks source link

feat: add code coverage #331

Closed bahmutov closed 4 years ago

bahmutov commented 4 years ago
{
  "env": {
    "coverage": false
  }
}

based on https://github.com/bahmutov/code-coverage-vue-example

bahmutov commented 4 years ago

seems upgrading the vue-loader is causing problems

bahmutov commented 4 years ago

babel-plugin-istanbul instruments Vue files, but only if there is .nycrc file with

{
  "extension": [".js", ".vue"]
}

Problem is how to pass these options without creating this file (or requiring any other NYC config options)

just for fun, nyc options from defaults and above file

this.nycConfig {
  cwd: '/Users/gleb/git/cypress-vue-unit-test',
  exclude: [
    'coverage/**',
    'packages/*/test{,s}/**',
    '**/*.d.ts',
    'test{,s}/**',
    'test{,-*}.{js,cjs,mjs,ts}',
    '**/*{.,-}test.{js,cjs,mjs,ts}',
    '**/__tests__/**',
    '**/{ava,nyc}.config.{js,cjs,mjs}',
    '**/jest.config.{js,cjs,mjs,ts}',
    '**/{karma,rollup,webpack}.config.js',
    '**/{babel.config,.eslintrc,.mocharc}.{js,cjs}'
  ],
  excludeNodeModules: true,
  include: [],
  extension: [ '.js', '.vue' ],
  coverageVariable: '__coverage__',
  coverageGlobalScope: 'this',
  coverageGlobalScopeFunc: true,
  ignoreClassMethods: []
}
bahmutov commented 4 years ago

:tada: This PR is included in version 3.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: