From fefc081e1b490f1dd2d4ca3f5f46bfd532397d83 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 17 Dec 2017 21:22:50 -0800 Subject: [PATCH] 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 --- packages/service-worker/test/BUILD.bazel | 2 -- packages/service-worker/worker/testing/scope.ts | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/service-worker/test/BUILD.bazel b/packages/service-worker/test/BUILD.bazel index ed6ba86bb0..636c8302a1 100644 --- a/packages/service-worker/test/BUILD.bazel +++ b/packages/service-worker/test/BUILD.bazel @@ -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", diff --git a/packages/service-worker/worker/testing/scope.ts b/packages/service-worker/worker/testing/scope.ts index 2599c04a36..c918e335d7 100644 --- a/packages/service-worker/worker/testing/scope.ts +++ b/packages/service-worker/worker/testing/scope.ts @@ -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;