-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (22 loc) · 786 Bytes
/
Copy pathindex.js
File metadata and controls
26 lines (22 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const soundPlayer = require('play-sound')();
const path = require('path');
const isWindows = process.platform === 'win32';
class jestFuck {
constructor () {
this.fuck = path.join(path.resolve(__dirname), 'misc/fuck.wav');
}
playSound (sound) {
soundPlayer.play(sound, function (err) {
if (err && isWindows) {
console.log('You are running windows. You need \'mplayer\' installed for jest-fuck to work properly.');
console.log('See https://www.npmjs.com/package/play-sound');
} else if (err) {
console.log(err);
}
});
}
onRunComplete (contexts, results) {
results.numFailedTests > 0 && this.playSound(this.fuck);
}
}
module.exports = jestFuck;