jest-reporter
Version:
Jest Reporter with customisable sounds and messages
78 lines (59 loc) • 2.8 kB
Markdown
# Custom Jest Reporter (jest-reporter)
Jest Reporter with customisable sounds and messages.
[](https://travis-ci.org/trembacz/jest-reporter)
[](https://david-dm.org/trembacz/jest-reporter?view=list)
[](https://david-dm.org/trembacz/jest-reporter?type=dev&view=list)
## Installing
```npm install --save-dev jest-reporter```
or
```yarn add -D jest-reporter```
## Getting Started
To use this reporter you will need to have an Jest test environment set up.
In your ```package.json``` add new reporter:
```json
"jest": {
"bail": false,
"reporters": [
"default",
[
"<rootDir>/node_modules/jest-reporter", {
"passSound": "sounds/customPass.wav",
"failSound": "sounds/customFail.wav",
"passText": "txt/customPass.txt",
"failText": "txt/customFail.txt",
"skipFailSound": false,
"skipFailText": false,
"skipPassSound": false,
"skipPassText": false
}
]
]
}
```
## Options
| Option | Value | Description |
| ------------------- |:-------------:| -------------------------------------------------------------------- |
| ```passSound``` | ```string``` | Path to sound file e.g "sounds/pass.wav" |
| ```failSound``` | ```string``` | Path to sound file e.g "sounds/fail.wav" |
| ```passText``` | ```string``` | Path to text file e.g "txt/pass.txt" |
| ```failText``` | ```string``` | Path to text file e.g "txt/fail.txt" |
| ```skipFailSound``` | ```boolean``` | Set to ```true``` if you want to disable sound effect on failed test |
| ```skipFailText``` | ```boolean``` | Set to ```true``` if you want to disable text message on failed test |
| ```skipPassSound``` | ```boolean``` | Set to ```true``` if you want to disable sound effect on passed test |
| ```skipPassText``` | ```boolean``` | Set to ```true``` if you want to disable text message on passed test |
**If you not specify sound or text files, default ones will be used.**
## Run
```npm run jest```
or
```yarn jest```
## Demo
You can even add **ASCII** images in txt files ;)
##

##

## Windows users
**You need "mplayer" installed on your system**
**Tip:** Copy ```mplayer.exe``` into folder with ```package.json```
## LICENSE
[MIT](LICENSE)