Cypress-cucumber-preprocessor: Use with Webpack?

Created on 6 Mar 2018  路  4Comments  路  Source: TheBrainFamily/cypress-cucumber-preprocessor

Is this the correct way to employ your plugin with webpack?

const cucumber = require( 'cypress-cucumber-preprocessor' ).default;
const webpack = require( '@cypress/webpack-preprocessor' );

module.exports = ( on /* config */ ) => {
  on( 'file:preprocessor', webpack());
  on( 'file:preprocessor', cucumber());
};
help wanted question

Most helpful comment

You can use

on('file:preprocessor', (file) => {
    if (file.filePath.match(/\.(js|jsx)/g)) {
      return webpack(options)(file)
    } else {
      return cucumber()(file)
    }
})

All 4 comments

@leegee not sure, as I've never used it with webpack. Do you get an error? Could you give us more information? :)
A repository with a reproduction would be fantastic

You can use

on('file:preprocessor', (file) => {
    if (file.filePath.match(/\.(js|jsx)/g)) {
      return webpack(options)(file)
    } else {
      return cucumber()(file)
    }
})

Thanks!

Very cool, thanks for helping @lobor :-)

Was this page helpful?
0 / 5 - 0 ratings