forked from cypress-io/cypress-example-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (26 loc) · 734 Bytes
/
index.js
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
27
28
29
30
/// <reference types="cypress" />
/* eslint-disable no-console */
// http://riaevangelist.github.io/node-ipc/
const ipc = require('node-ipc')
ipc.connectTo('cypressListener', () => {
ipc.of.cypressListener.on('connect', () => {
ipc.log('## connected to Cypress listener ##')
})
})
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
on('task', {
testFinished (attributes) {
// console.log(name)
console.log('%s: "%s" %dms', attributes.state, attributes.title, attributes.duration)
ipc.of.cypressListener.emit('test:after:run', {
state: attributes.state,
title: attributes.title,
duration: attributes.duration,
})
return null
},
})
}