【发布时间】:2015-12-23 00:14:40
【问题描述】:
我正在尝试使用 grunt-mocha-test 将所有测试结果保存在 JSON 文件中...
我只是不知道如何摆脱 console.log 输出,我只需要 JSON。
这是我的conf:
mochaTest: {
158 src: ['app/tests/middleware/**/*.js'],
159 options: {
162 reporter: 'json',
164 captureFile: './app/tests/results/mochaResult.json',
165 //quiet:'true',
166 require: 'server.js'
167 }
168 },
这是一个输出示例:
2 ^[[7m Application loaded using the "test" environment configuration
3 ^[[0m
4 connecting to mongodb...
5 name: localhost
6 app started on port 3000
7 successful connection to redis server
8 {
9 "stats": {
10 "suites": 1,
11 "tests": 5,
12 "passes": 5,
13 "pending": 0,
14 "failures": 0,
15 "start": "2015-12-23T00:01:43.968Z",
我错过了什么?有没有其他方法可以解决这个问题?
【问题讨论】:
标签: json testing gruntjs automated-tests mocha.js