cypress-io / code-coverage

Saves the code coverage collected during Cypress tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After integrating Cypress code coverage into Nuxt3, the app is not working properly

belwalshubham opened this issue · comments

I'm using the Vite Istanbul plugin to integrate cypress code coverage into my nuxt3 app. I'm getting the code coverage report, but my Nuxt3 app is not being compiled and is not functioning properly.
In our most recent version, we have the following code inside the Vite-Plugin-Istanbul folder:

transform(srcCode, id, options) {
      if (!enabled || options?.ssr || id.startsWith(MODULE_PREFIX) || id.startsWith(NULL_STRING)) {
        return;
      }
      if (testExclude.shouldInstrument(id)) {
        const sourceMap = sanitizeSourceMap(this.getCombinedSourcemap());
        const code = instrumenter.instrumentSync(srcCode, id, sourceMap);
        const map = instrumenter.lastSourceMap();
        return { code, map };
      }
    }

Though I'm getting options.ssr value as both true & false for different files, when I run npm run dev, my app does not run properly, and an error message appears on the console, as shown in the screenshot below.

error code coverage

The problem has been resolved