安装mochawesome
npm i mochawesome |
如果有以下报错
"mochawesome" reporter not found invalid reporter "mochawesome" |
执行安装命令
npm i mocha -D |
codeceptjs.conf.js文件中加入
mocha: { reporterOptions: { reportDir: "output" } }, |
运行,执行命令
npx codeceptjs run --reporter mochawesome |
生成测试报告mochawesome.html
全部内容
const { setHeadlessWhen } = require( '@codeceptjs/configure' ); // turn on headless mode when running with HEADLESS=true environment variable // HEADLESS=true npx codecept run setHeadlessWhen(process.env.HEADLESS); exports.config = { output: './output' , helpers: { Puppeteer: { show: true , windowSize: '1920x1080' } }, include: { }, bootstrap: null , mocha: {}, name: 'codeceptdemo' , translation: 'zh-CN' , mocha: { reporterOptions: { reportDir: "output" } }, plugins: { retryFailedStep: { enabled: true }, screenshotOnFail: { enabled: true } } } |