cypress-browserify-preprocessor icon indicating copy to clipboard operation
cypress-browserify-preprocessor copied to clipboard

`hastsifyPlugin` assume the plugin is passed as a string

Open ben8p opened this issue 4 years ago • 0 comments

  • 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

Additional Info (images, stack traces, etc)

ben8p avatar Jan 08 '21 13:01 ben8p