cypress-and-jest
cypress-and-jest copied to clipboard
Using it with TypeScript
I tried using samples from this repo in order to get coverage from TypeScript files. Unfortunately, it looks I'm missing the way to provide TypeScript config to the Browserify instance. With browserify it could be like that:
browserify({
typescript: require.resolve('typescript')
})
I tried to do that:
module.exports = (on, config) => {
require('@cypress/code-coverage/task')(on, config);
const options = browserify.defaultOptions;
options.typescript = require.resolve('typescript');
on('file:preprocessor', browserify(options));
return config;
};
But it fails with an error. How should I pass the TypeScript config to Browserify?
the only blocker in my case for TS + create react app unejected is just not being able to set the jest coverageDirectory ... i'm just going to write a script to rename the jest coverage dir followed by the merge command
the only thing i needed was for my plugins/index.ts
module.exports = (on, config) => {
require('@cypress/code-coverage/task')(on, config)
return config
}
along with the babel.rc
{
"plugins": ["istanbul"]
}
after that calling react scripts start with the instrument-cra pckg
react-scripts -r @cypress/instrument-cra start
TBH you should resolve your cypress code coverage issues in the code-coverage project before trying to use this package for merging the reports