From 9bcce8864d7328cdd7571dda9828401034c9dbe6 Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Mon, 10 Feb 2020 16:37:57 -0800 Subject: [PATCH] fix(adapter): do not emit debug url unless in a browser (#263) 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