Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using it with TypeScript #99

Open
sunpietro opened this issue Apr 26, 2021 · 1 comment
Open

Using it with TypeScript #99

sunpietro opened this issue Apr 26, 2021 · 1 comment

Comments

@sunpietro
Copy link

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?

@hiqqs
Copy link

hiqqs commented Mar 2, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants