build: add bazel test rules for remainder of packages (#21053)

PR Close #21053
This commit is contained in:
Misko Hevery
2017-12-17 15:10:54 -08:00
committed by Igor Minar
parent cc1058f6e1
commit 3d50fd7cac
88 changed files with 912 additions and 322 deletions

View 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",
],
)

View File

@ -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();
});

View File

@ -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;

View 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 = [
],
)

View File

@ -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",
],

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;