Skip to content

Commit 27f5dc7

Browse files
committed
fix(adapter): do not emit debug url unless in a browser
Surprise: someone uses karma-jasmine with native=script. Fixes karma-runner#262
1 parent fb33d57 commit 27f5dc7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/adapter.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ function KarmaReporter (tc, jasmineEnv) {
247247
result.log.push(formatFailedStep(steps[i]))
248248
}
249249

250-
// Report the name of fhe failing spec so the reporter can emit a debug url.
251-
result.debug_url = debugUrl(specResult.fullName)
250+
if (typeof window !== 'undefined' && window.location && window.location.origin) {
251+
// Report the name of fhe failing spec so the reporter can emit a debug url.
252+
result.debug_url = debugUrl(specResult.fullName)
253+
}
252254
}
253255

254256
// When failSpecWithNoExpectations is true, Jasmine will report specs without expectations as failed

0 commit comments

Comments
 (0)