cypress-browserify-preprocessor
cypress-browserify-preprocessor copied to clipboard
Seems we cannot use custom tsify
Cypress v6 @cypress/browserify-preprocessor 3.0.1
my settings specify tsify plugin
const browserify = require('@cypress/browserify-preprocessor')
module.exports = (on, config) => {
const options = browserify.defaultOptions
options.browserifyOptions.extensions.push('.ts')
options.browserifyOptions.transform.push('browserify-istanbul')
options.browserifyOptions.plugin.push('tsify')
on('file:preprocessor', browserify(options))
}
Then I get the following message
But if I also use typescript: require.resolve('typescript') option, then my tsify plugin is not used (./lib/simple_tsify is used instead)
Reproducible example https://github.com/cypress-io/code-coverage/tree/try-tsify
- clone
npm installcd examples/unit-tests-tsDEBUG=cypress:browserify npm run cy:open
I need custom tsify to instrument the transpiled code. Something like this works for me from Node
// can we instrument typescript code using Istanbul?
const browserify = require('browserify');
// https://github.com/TypeStrong/tsify
const tsify = require('tsify');
// https://github.com/devongovett/browserify-istanbul
const istanbul = require('browserify-istanbul')
browserify()
.add('main.ts')
.plugin(tsify)
.transform(istanbul)
.bundle()
.on('error', function (error) { console.error(error.toString()); })
.pipe(process.stdout);
@bahmutov Can u please provide a solution to this issue? Of all the work we did to replace testing framework from Jest and Selenium to Cypress last year, this is the only limitation we are stuck now. Thanks.