3.6 jest使用jest-html-reporters
作者:互联网
官方地址:https://github.com/roughsoft/jest-html-reporters
注意,是jest-html-reporters,不是jest-html-reporter
一、直接安装
npm install jest-html-reporters
二、在jest.config.js中添加配置文件
const moment = require('moment');
const date = moment(new Date()).format('YYYY-MM-DD-HH-mm-ss');
module.exports = {
testEnvironment: "node",
reporters:[
"default",
[
"jest-html-reporters",
{
"pageTitle":"Jest Report",
"filename":`./report/child/${date}.html`,
"expand":true
}
]
],
};
filename中的目录需要提前建好
标签:const,filename,3.6,moment,html,jest,reporters 来源: https://blog.csdn.net/LetsStudy/article/details/119132771