@@ -17,6 +17,10 @@ function getKey (client) {
1717 return `${ client . currentTest . module } : ${ client . currentTest . name } `
1818}
1919
20+ function shouldSkipBrowserstackReporting ( client ) {
21+ return ! BS_USER || ! BS_KEY || client . options . selenium_port !== 80
22+ }
23+
2024/**
2125 * Generates an object with beforeEach and afterEach functions to be added
2226 * to every test suite. It cannot be added globably because these must be
@@ -28,7 +32,7 @@ module.exports = function sendStatus () {
2832 return {
2933 beforeEach ( browser , cb ) {
3034 // avoid running if missing credentials
31- if ( ! BS_USER || ! BS_KEY ) return cb ( )
35+ if ( shouldSkipBrowserstackReporting ( this . client ) ) return cb ( )
3236 // retrieve the session and save it to the map
3337 const key = getKey ( this . client )
3438 browser . session ( ( { sessionId } ) => {
@@ -39,7 +43,7 @@ module.exports = function sendStatus () {
3943
4044 afterEach ( browser , cb ) {
4145 // avoid running if missing credentials
42- if ( ! BS_USER || ! BS_KEY ) return cb ( )
46+ if ( shouldSkipBrowserstackReporting ( this . client ) ) return cb ( )
4347 const key = getKey ( this . client )
4448 const { results } = this . client . currentTest
4549 const sessionId = sessionMap [ key ]
0 commit comments