Skip to content

Commit 39943d7

Browse files
committed
fix: fix reporter with browsers not launched through launcher
Close #232
1 parent 1d4d623 commit 39943d7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/reporter/reporter.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,25 @@ export function SaucelabsReporter(logger, browserMap: BrowserMap) {
2828
// This fires when a single test is executed and will update the run in sauce labs with an annotation
2929
// of the test including the status of the test
3030
this.onSpecComplete = function (browser, result) {
31+
const browserId = browser.id;
32+
const browserData = browserMap.get(browserId);
33+
34+
// Do nothing if the current browser has not been launched through the Saucelabs
35+
// launcher.
36+
if (!browserData) {
37+
return;
38+
}
39+
3140
const status = result.success ? '✅' : '❌'
3241

33-
browserMap.get(browser.id).results.push({
42+
browserData.results.push({
3443
status: 'info',
3544
message: `${status} ${result.fullName}`,
3645
screenshot: null
3746
})
3847

3948
if (!result.success && result.log.length > 0) {
40-
browserMap.get(browser.id).results.push({
49+
browserData.results.push({
4150
status: 'info',
4251
message: `${result.log[0]}`,
4352
screenshot: null

0 commit comments

Comments
 (0)