numerous-receptionist-75365
03/16/2023, 2:03 PMcy.task('coverageReport') fails with the following error:
The argument 'path' must be a string or Uint8Array without null bytes. Received '/Users/redacted/Documents/projects/redacted/backoffice-fe/cypress-coverage/lcov-report/backoffice-fe/\x00commonjsHelpers.js.html'
I don't know what that file is and why the name starts with a null byte. This happens both on my machine and in CI.
I cannot find anything on Google, I would be very thankful if anyone had a clue.
Thanksnumerous-receptionist-75365
03/16/2023, 2:07 PMjs
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
require("@cypress/code-coverage/task")(on, config);
return config;
},
experimentalStudio: true,
experimentalWebKitSupport: true,
specPattern: "cypress/e2e/**/*.cy.ts",
baseUrl: "http://localhost:3000",
},
component: {
setupNodeEvents(on, config) {
require("@cypress/code-coverage/task")(on, config);
return config;
},
devServer: {
framework: "react",
bundler: "vite",
},
specPattern: "src/**/*.cy.{ts,tsx}",
},
});
My vite config file is the following:
js
export default defineConfig({
plugins: [react({ babel: { plugins: ["istanbul"] } }), tsconfigPaths()],
server: { port: 3000, proxy: { "/api": "http://localhost:8080" } },
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/setupTests.ts",
coverage: {
reportsDirectory: "vitest-coverage",
reporter: ["text", "lcov", "json"],
exclude: ["node_modules", "src/setupTests.ts"],
},
},
build: { outDir: "./build" },
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
},
});
Also, in package.json I have configured nyc to output the report to a folder named cypress-coverage so it doesn't override the output of my vitest test. The reports are merged later in the pipeline