From 27f5dc74e3b6688638a41dce6ba244138d05eabb Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Fri, 7 Feb 2020 17:22:32 -1000 Subject: [PATCH] fix(adapter): do not emit debug url unless in a browser Surprise: someone uses karma-jasmine with native=script. Fixes #262 --- src/adapter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/adapter.js b/src/adapter.js index 4485355..c98b0c1 100644 --- a/src/adapter.js +++ b/src/adapter.js @@ -247,8 +247,10 @@ function KarmaReporter (tc, jasmineEnv) { result.log.push(formatFailedStep(steps[i])) } - // Report the name of fhe failing spec so the reporter can emit a debug url. - result.debug_url = debugUrl(specResult.fullName) + if (typeof window !== 'undefined' && window.location && window.location.origin) { + // Report the name of fhe failing spec so the reporter can emit a debug url. + result.debug_url = debugUrl(specResult.fullName) + } } // When failSpecWithNoExpectations is true, Jasmine will report specs without expectations as failed