cypress-browserify-preprocessor
cypress-browserify-preprocessor copied to clipboard
`hastsifyPlugin` assume the plugin is passed as a string
- Operating System: Ubuntu 18.04
- Cypress Version: 6.1.0
- Browser Version: Chrome 87.0.4280.88
Is this a Feature or Bug?
This is a bug
Current behavior:
When checking for tsify
plugin, the code is assume to have a string in plugin
:
const hastsifyPlugin = browserifyOptions.plugin.includes('tsify')
Desired behavior:
plugin
can also be an array, for instance:
browserifyOptions.plugin.unshift([resolve.sync('tsify'), { project: './cypress/tsconfig.json' }]);
The code should take that into account, with something like:
const hastsifyPlugin = browserifyOptions.plugin.some((entry) => (typeof entry === 'string' && entry.includes('tsify')) || (entry && entry.length && entry[0].includes('tsify')))
How to reproduce:
- Use
browserifyOptions.plugin.unshift([resolve.sync('tsify'), { project: './cypress/tsconfig.json' }]);
in the config - specify the
typescript
property
no error raised