Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 31 32 33 34 35 36 37 38 39 40 41 | 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x | import testingbotTunnel from 'testingbot-tunnel-launcher'
export default class TestingBotLauncher {
onPrepare (config) {
if (!config.tbTunnel) {
return
}
this.tbTunnelOpts = Object.assign({
apiKey: config.user,
apiSecret: config.key
}, config.tbTunnelOpts)
config.protocol = 'http'
config.hostname = 'localhost'
config.port = 4445
return new Promise((resolve, reject) => testingbotTunnel(this.tbTunnelOpts, (err, tunnel) => {
/* istanbul ignore if */
if (err) {
return reject(err)
}
this.tunnel = tunnel
return resolve()
}))
}
/**
* Shut down the tunnel
* @returns {Promise} Resolved promise when tunnel is closed
*/
onComplete () {
if (!this.tunnel) {
return
}
return new Promise(resolve => this.tunnel.close(resolve))
}
}
|