acoustic-psychiatrist-35111
02/23/2023, 12:23 PMhigh-holiday-75305
02/23/2023, 2:17 PMwindow.__coverage__. If instrumentation is being applied to your application code, this should evaluate to an object where the keys are absolute paths to files within application code, and the values are the coverage data about the individual files. If instrumentation is not being applied, this would evaluate to undefined
Can you give that a check and let me know what you see?high-holiday-75305
02/23/2023, 2:21 PMacoustic-psychiatrist-35111
02/23/2023, 4:13 PMacoustic-psychiatrist-35111
02/23/2023, 4:14 PMhigh-holiday-75305
02/23/2023, 4:24 PMconst { when } = require('@craco/craco');
module.exports = () => ({
babel: when(process.env.COVERAGE, () => ({
plugins: ['istanbul'],
})),
});
This makes it so that when you run, say, COVERAGE=true craco start babel will instrument the build.high-holiday-75305
02/23/2023, 4:28 PMhigh-holiday-75305
02/23/2023, 4:28 PMhigh-holiday-75305
02/23/2023, 4:29 PMCOVERAGE=true craco start then loading your app in a regular web browser. You should be able to get at the window.__coverage__ object that way. Then you can take the next step of seeing how you would set the Cypress devServer settings to make that happen in component tests.high-holiday-75305
02/23/2023, 4:31 PMbabel-plugin-istanbul (https://github.com/cypress-io/code-coverage#instrument-your-application) and CRACO's docs on configuring babel (https://craco.js.org/docs/configuration/babel/)