【问题标题】:Script to generate JSON report for mocha test report while using babel-cli使用 babel-cli 为 mocha 测试报告生成 JSON 报告的脚本
【发布时间】:2018-06-28 17:02:46
【问题描述】:

我正在使用 mocha 和 babel-cli,我可以使用脚本运行 mocha 测试

"mocha --compilers js:babel-core/register --recursive"

我不使用 babel 时,我可以使用脚本生成 JSON 报告

./node_modules/mocha/bin/mocha -R json> report 

有没有人有解决方案(脚本)说明如何获取 json 报告使用 babel 和 mocha 时

【问题讨论】:

  • 什么具体不起作用?您是否收到特定错误?

标签: javascript node.js mocha.js babeljs package.json


【解决方案1】:

这是使用 babel 和 es6 标准代码时获取 mocha 测试的 json 报告文件的脚本。

"./node_modules/mocha/bin/mocha -R json> report.json --require babel-core/register --recursive"

package.json 文件中的 babel 依赖项 -

  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1"
  } 

【讨论】:

    猜你喜欢
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-09
    • 2014-09-26
    • 2019-03-01
    • 2013-09-03
    • 1970-01-01
    相关资源
    最近更新 更多