[英]Cypress - adding Cucumber
这是一个非常基本的问题,但由于我从来没有做过前端开发人员,所以 js 和 ts 对我来说很陌生。
我正在尝试将 Cucumber 功能添加到 Cypress 测试套件中。 我已经安装了 cypress-cucumber-preprocessor package,但是当我能找到的所有 howto 和信息都使用 js 作为示例时,我遇到了问题。
我应该把它放到 index.js 文件中:
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
由于测试套件有一个 index.ts 文件,自然无法复制粘贴。如何将其转换为 .ts?
该特定代码应在index.ts
中作为
import { default as cucumber } from 'cypress-cucumber-preprocessor'
// or just
import cucumber from 'cypress-cucumber-preprocessor'
export default (on, config) => {
on('file:preprocessor', cucumber())
}
安装:
npm install --save-dev cypress-cucumber-preprocessor
npm install --save-dev @types/cypress-cucumber-preprocessor
一般来说,cypress-realworld-app有 typescript 作为例子的来源(但不是黄瓜)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.