首页 > 解决方案 > 如何配置 package.json 以在 jest 中生成 HTML 报告(我没有使用 jest.config.json 文件)

问题描述

我正在测试节点应用程序的其余 API。我有很多测试套件,所以我想为测试生成一个 html 报告,我已经安装了 jest-html-reporter。但我不知道如何在 package.json 中配置(我没有使用 jest.config.json 文件)

包.json

{
  "name": "products_api",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "jest"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.0",
    "fs": "0.0.1-security",
    "jest": "^24.8.0",
    "jest-html-reporter": "^2.5.0",
    "joi": "^14.3.1",
    "mongodb": "^3.2.5",
    "redis": "^2.8.0",
    "supertest": "^4.0.2",
    "util": "^0.12.0"
  }
}

标签: javascriptnode.jsjestjs

解决方案


推荐阅读