cypress-io / code-coverage

Saves the code coverage collected during Cypress tests
MIT License
431 stars 108 forks source link

[Feature request] Example for stenciljs #400

Open maxkarkowski opened 3 years ago

maxkarkowski commented 3 years ago

Is there a possibility to have an example for a stencilJS project?

bahmutov commented 3 years ago

Can you set up a simple StencilJS project repo that I could fork?

maxkarkowski commented 3 years ago

sure: i have a very simple stencil + cypress project set up here https://github.com/maxkarkowski/stencil-example

tfrijsewijk commented 3 years ago
// stencil.config.ts
const istanbul = require('rollup-plugin-istanbul');

export const config: Config = {
  plugins: [
    istanbul({
      exclude: ['**.spec.ts']
    })
  ]
};

Instrumenting worked, my compiled assets contained all sorts of gibberish. I also confirmed window.__coverage__ etc, I installed the @cypress/code-coverage plugin but the test runner errored out, I guess because of lazy loading components.. When the test runner tried to generate a report it was unable to open

cy.task('coverageReport') failed with the following error no such file or directory, open NOENT @lazy-browser-entrypoint?app-data=conditional