build: add karma tests for render3 (#21188)

PR Close #21188
This commit is contained in:
Miško Hevery 2017-12-27 10:54:19 -08:00
parent 3750ea9dff
commit 9f538a6cac
2 changed files with 35 additions and 5 deletions

View File

@ -1,14 +1,18 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
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 = "lib",
name = "render3_lib",
testonly = 1,
srcs = glob(
["**/*.ts"],
exclude = ["**/*_perf.ts"],
exclude = [
"**/*_perf.ts",
"domino.d.ts",
"load_domino.ts",
],
),
tsconfig = "//packages:tsconfig.json",
deps = [
@ -22,12 +26,37 @@ ts_library(
],
)
ts_library(
name = "render3_node_lib",
testonly = 1,
srcs = [
"domino.d.ts",
"load_domino.ts",
],
tsconfig = "//packages:tsconfig",
deps = [
":render3_lib",
],
)
jasmine_node_test(
name = "render3",
bootstrap = [
"angular_src/packages/core/test/render3/load_domino",
],
deps = [
":lib",
":render3_node_lib",
],
)
ts_web_test(
name = "render3_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":render3_lib",
],
)

View File

@ -15,7 +15,8 @@ import {getRendererFactory2} from './imported_renderer2';
export const document = ((global || window) as any).document;
export let containerEl: HTMLElement = null !;
let host: LElement|null;
const isRenderer2 = process.argv[3] && process.argv[3] === '--r=renderer2';
const isRenderer2 =
typeof process == 'object' && process.argv[3] && process.argv[3] === '--r=renderer2';
// tslint:disable-next-line:no-console
console.log(`Running tests with ${!isRenderer2 ? 'document' : 'Renderer2'} renderer...`);
const testRendererFactory: RendererFactory3 =