提问人:Kiowa 提问时间:11/2/2023 最后编辑:Kiowa 更新时间:11/2/2023 访问量:79
使用 Cypress v13.4.0 设置 cypress-cucumber-preprocessor
Setting up cypress-cucumber-preprocessor with Cypress v13.4.0
问:
我在 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",
这是我使用的配置,取自 cypress-cucumber-preprocessor/examples/esbuild-cjs /cypress.config.js
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;
},
},
})
该配置与我使用的最后一个版本几乎相同,具有以下版本:
"@badeball/cypress-cucumber-preprocessor": "^15.0.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
"cypress": "^12.1.0",
除了当时是默认导出。createEsbuildPlugin
我尝试了最新的默认导入和命名导入,但两者都给出了错误。
还尝试了推荐的添加(在旧项目中未使用)tsconfig.json
"compilerOptions": {
"module": "nodenext",
}
答: 暂无答案
评论