Skip to content

Add output option to JSON reporter #4131

@munierujp

Description

@munierujp

Describe the solution you'd like
I'd like to use test report for other applications (e.g. Slack)
So, JSON file is useful.

package.json:

{
  "scripts": {
    "test": "mocha ./test/*-test.js --reporter json --reporter-options output=report.json",
    "posttest": "node slack.js"
  }
}

slack.js:

const readJSONFile = require('./readJSONFile')
const createMessage = require('./createMessage')
const postMessage = require('./postMessage')

const report = await readJSONFile('report.json')
const message = createMessage(report)
await postMessage(message)

Describe alternatives you've considered

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions