npm i @bahmutov/cypress-esbuild-preprocessor -D
npm i @badeball/cypress-cucumber-preprocessor -D
cypress.config.js
const { defineConfig } = require('cypress')
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor')
const addCucumberPreprocessorPlugin = require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin
const createEsbuildPlugin = require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin
module.exports = defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const bundler = createBundler({
plugins: [createEsbuildPlugin(config)],
})
on('file:preprocessor', bundler)
await addCucumberPreprocessorPlugin(on, config)
return config
},
specPattern: 'cypress/e2e/**/*.feature', // 设置 .feature 文件的路径
},
})
Source link
lol