build: add bazel test rules for remainder of packages (#21053)
PR Close #21053
This commit is contained in:
42
packages/service-worker/test/BUILD.bazel
Normal file
42
packages/service-worker/test/BUILD.bazel
Normal file
@ -0,0 +1,42 @@
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
|
||||
|
||||
ts_library(
|
||||
name = "test_lib",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
tsconfig = "//packages:tsconfig",
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/core",
|
||||
"//packages/core/testing",
|
||||
"//packages/service-worker",
|
||||
"//packages/service-worker/testing",
|
||||
"//packages/service-worker/worker",
|
||||
"//packages/service-worker/worker/testing",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
bootstrap = ["angular_src/packages/_testing_init/init_node_spec.js"],
|
||||
deps = [
|
||||
":test_lib",
|
||||
"//packages/_testing_init:node",
|
||||
],
|
||||
)
|
||||
|
||||
ts_web_test(
|
||||
name = "test_web",
|
||||
bootstrap = [
|
||||
"//:angular_bootstrap_scripts",
|
||||
],
|
||||
# dissable since tests are running but not yet passing
|
||||
tags = ["manual"],
|
||||
# do not sort
|
||||
deps = [
|
||||
"//packages/_testing_init:browser",
|
||||
":test_lib",
|
||||
],
|
||||
)
|
@ -30,14 +30,14 @@ import {MockServiceWorkerContainer, MockServiceWorkerRegistration} from '../test
|
||||
|
||||
mock.setupSw();
|
||||
|
||||
comm.registration.subscribe(reg => { done(); });
|
||||
(comm as any).registration.subscribe((reg: any) => { done(); });
|
||||
});
|
||||
it('can access the registration when it comes after subscription', (done: DoneFn) => {
|
||||
const mock = new MockServiceWorkerContainer();
|
||||
const comm = new NgswCommChannel(mock as any, 'browser');
|
||||
const regPromise = mock.getRegistration() as any as MockServiceWorkerRegistration;
|
||||
|
||||
comm.registration.subscribe(reg => { done(); });
|
||||
(comm as any).registration.subscribe((reg: any) => { done(); });
|
||||
|
||||
mock.setupSw();
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ const server = new MockServerStateBuilder().withStaticFiles(dist).withManifest(m
|
||||
const serverUpdate =
|
||||
new MockServerStateBuilder().withStaticFiles(distUpdate).withManifest(manifestUpdate).build();
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
// Skip environments that don't support the minimum APIs needed to run the SW tests.
|
||||
if (!SwTestHarness.envIsSupported()) {
|
||||
return;
|
||||
|
13
packages/service-worker/testing/BUILD.bazel
Normal file
13
packages/service-worker/testing/BUILD.bazel
Normal file
@ -0,0 +1,13 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
module_name = "@angular/service-worker/testing",
|
||||
tsconfig = "//packages:tsconfig",
|
||||
deps = [
|
||||
],
|
||||
)
|
@ -18,8 +18,6 @@ ts_library(
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
srcs = [],
|
||||
# TODO(alxhub): re-enable when need for main() is removed
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
":test_lib",
|
||||
],
|
||||
|
@ -114,7 +114,7 @@ function asyncWrap(fn: () => Promise<void>): (done: DoneFn) => void {
|
||||
return (done: DoneFn) => { fn().then(() => done(), err => done.fail(err)); };
|
||||
}
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
// Skip environments that don't support the minimum APIs needed to run the SW tests.
|
||||
if (!SwTestHarness.envIsSupported()) {
|
||||
return;
|
||||
|
@ -139,7 +139,7 @@ const scope = new SwTestHarnessBuilder().withServerState(server).build();
|
||||
const manifestHash = sha1(JSON.stringify(manifest));
|
||||
const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate));
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
// Skip environments that don't support the minimum APIs needed to run the SW tests.
|
||||
if (!SwTestHarness.envIsSupported()) {
|
||||
return;
|
||||
|
@ -10,7 +10,7 @@ import {IdleScheduler} from '../src/idle';
|
||||
import {SwTestHarness, SwTestHarnessBuilder} from '../testing/scope';
|
||||
import {async_beforeEach, async_fit, async_it} from './async';
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
// Skip environments that don't support the minimum APIs needed to run the SW tests.
|
||||
if (!SwTestHarness.envIsSupported()) {
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ const db = new CacheDatabase(scope, scope);
|
||||
|
||||
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
// Skip environments that don't support the minimum APIs needed to run the SW tests.
|
||||
if (!SwTestHarness.envIsSupported()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user