build(service-worker): enable karma bazel test for service-worker (#21053)

Corrected the environment detection code which was incorretly throwing exception in the browser if `require` function was found.

PR Close #21053
This commit is contained in:
Misko Hevery 2017-12-17 21:22:50 -08:00 committed by Igor Minar
parent bdee1f4a25
commit fefc081e1b
2 changed files with 1 additions and 4 deletions

View File

@ -32,8 +32,6 @@ ts_web_test(
bootstrap = [
"//:angular_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
tags = ["manual"],
# do not sort
deps = [
"//packages/_testing_init:browser",

View File

@ -96,8 +96,7 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
} as any;
static envIsSupported(): boolean {
return (typeof require === 'function' && typeof require('url')['parse'] === 'function') ||
(typeof URL === 'function');
return (typeof URL === 'function') || (typeof require === 'function' && typeof require('url')['parse'] === 'function');
}
time: number;