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:
parent
bdee1f4a25
commit
fefc081e1b
|
@ -32,8 +32,6 @@ ts_web_test(
|
||||||
bootstrap = [
|
bootstrap = [
|
||||||
"//:angular_bootstrap_scripts",
|
"//:angular_bootstrap_scripts",
|
||||||
],
|
],
|
||||||
# dissable since tests are running but not yet passing
|
|
||||||
tags = ["manual"],
|
|
||||||
# do not sort
|
# do not sort
|
||||||
deps = [
|
deps = [
|
||||||
"//packages/_testing_init:browser",
|
"//packages/_testing_init:browser",
|
||||||
|
|
|
@ -96,8 +96,7 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
static envIsSupported(): boolean {
|
static envIsSupported(): boolean {
|
||||||
return (typeof require === 'function' && typeof require('url')['parse'] === 'function') ||
|
return (typeof URL === 'function') || (typeof require === 'function' && typeof require('url')['parse'] === 'function');
|
||||||
(typeof URL === 'function');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
time: number;
|
time: number;
|
||||||
|
|
Loading…
Reference in New Issue