我正试图用TypeScript实现Cypress 11的柏树预处理器,但我不确定我错过了什么。以下是我所做的步骤:
npm install @badeball/cypress-黄瓜-预处理器
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
export default defineConfig({
projectId: '7emkc5',
reporter: 'mochawesome',
reporterOptions: {
reportDir: 'cypress/report/mochawesome-report',
overwrite: false,
html: true,
json: true,
timestamp: 'dd-mm-yyyy_HH-MM-ss',
},
chromeWebSecurity: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
})
I am using the last version of Cypress 11.1.0 and typescript.
发布于 2022-11-18 22:20:09
只需按照指南安装TS https://docs.cypress.io/guides/tooling/typescript-support#Install-TypeScript即可
然后,将此https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/quick-start.md粘贴到cypress.config.ts中。
还安装bahmutov lib:
npm i @bahmutov/cypress-esbuild-preprocessor
这对我有用..。祝好运!
发布于 2022-11-19 17:35:35
下面是使用10+向Cypress TypeScript添加插件的干净流程:
然而,现在我有了一个不同的问题。我似乎无法在“setupNodeEvents”方法中添加一些插件。我问了一个新问题,这里。
https://stackoverflow.com/questions/74492646
复制相似问题