Cypress: Multiple preprocessors?

Created on 30 Nov 2019  路  3Comments  路  Source: cypress-io/cypress

I haven't found any information in the docs about support for multiple preprocessors.

I've used the webpack preprocessor in some projects, and the cucumber proprocessor i others. For my new project, I'd like to use them both.

I tried adding two `on('file:preprocessor') like this:

    on('file:preprocessor', cucumber())
    on('file:preprocessor', wp({
        webpackOptions: require('../../webpack.config'),
    }))

but then it doesn't preprocess the .feature files.

Any advice?

Most helpful comment

Nevermind, I managed to solve it.

This works:

    on('file:preprocessor', file => {
        return file.filePath.includes('.feature')
            ? cucumber()(file)
            : wp({
                webpackOptions: webpackConfig,
            })(file)
    })

All 3 comments

Nevermind, I managed to solve it.

This works:

    on('file:preprocessor', file => {
        return file.filePath.includes('.feature')
            ? cucumber()(file)
            : wp({
                webpackOptions: webpackConfig,
            })(file)
    })

Actually, I do need to support more than one preprocessor at the same time. Is it possible?

Wondering the same thing as @Maximus1285

Was this page helpful?
0 / 5 - 0 ratings