Kio*_*owa 6 cypress cypress-cucumber-preprocessor
我在 cypress-cucumber-preprocessor 的最新配置中遇到错误
您的 configFile 从以下位置抛出错误: ...\cypress.config.ts
执行 e2e.setupNodeEvents() 函数时抛出错误:
TypeError: (0 , cypress_esbuild_preprocessor_1.default) 不是函数...
版本:
"@badeball/cypress-cucumber-preprocessor": "^18.0.6",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"cypress": "^13.4.0",
Run Code Online (Sandbox Code Playgroud)
这是我使用的配置,取自cypress-cucumber-preprocessor/examples/esbuild-cjs /cypress.config.js
"@badeball/cypress-cucumber-preprocessor": "^18.0.6",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"cypress": "^13.4.0",
Run Code Online (Sandbox Code Playgroud)
配置与我使用的最后一个版本几乎相同,有以下版本:
"@badeball/cypress-cucumber-preprocessor": "^15.0.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
"cypress": "^12.1.0",
Run Code Online (Sandbox Code Playgroud)
只是当时createEsbuildPlugin
是默认导出。
我尝试了最新的默认值和命名导入,但都给出了错误。
还尝试了tsconfig.json
推荐的添加(旧项目中未使用)
import { defineConfig } from "cypress";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
export default defineConfig({
e2e: {
specPattern: "**/*.feature",
async setupNodeEvents(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): Promise<Cypress.PluginConfigOptions> {
await addCucumberPreprocessorPlugin(on, config);
on("file:preprocessor", createBundler({plugins: [createEsbuildPlugin(config)]}));
return config;
},
},
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
288 次 |
最近记录: |