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

PR Close #21053
This commit is contained in:
Misko Hevery 2017-12-16 20:08:49 -08:00 committed by Igor Minar
parent 47e251a80a
commit cc1058f6e1
9 changed files with 122 additions and 22 deletions

View File

@ -0,0 +1,15 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "locales",
srcs = glob(
["**/*.ts"],
exclude = ["closure-locale.ts"],
),
module_name = "@angular/common/locales",
tsconfig = "//packages:tsconfig",
deps = [
],
)

View File

@ -12,5 +12,6 @@
* Entry point for all public APIs of this package.
*/
export * from './src/common';
export {registerLocaleData as ɵregisterLocaleData} from './src/i18n/locale_data';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -27,8 +27,6 @@ export abstract class NgLocalization {
* Returns the plural category for a given value.
* - "=value" when the case exists,
* - the plural category otherwise
*
* @internal
*/
export function getPluralCategory(
value: number, cases: string[], ngLocalization: NgLocalization, locale?: string): string {

View File

@ -0,0 +1,43 @@
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"],
exclude = ["**/*_node_only_spec.ts"],
),
tsconfig = "//packages:tsconfig",
deps = [
"//packages/compiler",
"//packages/common",
"//packages/common/locales",
"//packages/core",
"//packages/core/testing",
"//packages/platform-browser",
"//packages/platform-browser/testing",
"//packages/platform-browser-dynamic",
],
)
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",
],
# do not sort
deps = [
"//packages/_testing_init:browser",
":test_lib",
],
)

View File

@ -6,10 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import localeCaESVALENCIA from '../../locales/ca-ES-VALENCIA';
import localeEn from '../../locales/en';
import localeFr from '../../locales/fr';
import localeFrCA from '../../locales/fr-CA';
import localeCaESVALENCIA from '@angular/common/locales/ca-ES-VALENCIA';
import localeEn from '@angular/common/locales/en';
import localeFr from '@angular/common/locales/fr';
import localeFrCA from '@angular/common/locales/fr-CA';
import {registerLocaleData} from '../../src/i18n/locale_data';
import {findLocaleData} from '../../src/i18n/locale_data_api';

View File

@ -6,10 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import localeRo from '../../locales/ro';
import localeSr from '../../locales/sr';
import localeZgh from '../../locales/zgh';
import localeFr from '../../locales/fr';
import localeRo from '@angular/common/locales/ro';
import localeSr from '@angular/common/locales/sr';
import localeZgh from '@angular/common/locales/zgh';
import localeFr from '@angular/common/locales/fr';
import {LOCALE_ID} from '@angular/core';
import {TestBed, inject} from '@angular/core/testing';
import {NgLocaleLocalization, NgLocalization, getPluralCategory, DEPRECATED_PLURAL_FN, getPluralCase} from '../../src/i18n/localization';

View File

@ -9,12 +9,12 @@
import {DatePipe, registerLocaleData} from '@angular/common';
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
import localeEn from '../../locales/en';
import localeEnExtra from '../../locales/extra/en';
import localeDe from '../../locales/de';
import localeHu from '../../locales/hu';
import localeSr from '../../locales/sr';
import localeTh from '../../locales/th';
import localeEn from '@angular/common/locales/en';
import localeEnExtra from '@angular/common/locales/extra/en';
import localeDe from '@angular/common/locales/de';
import localeHu from '@angular/common/locales/hu';
import localeSr from '@angular/common/locales/sr';
import localeTh from '@angular/common/locales/th';
{
describe('DatePipe', () => {

View File

@ -6,9 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/
import localeEn from '../../locales/en';
import localeEsUS from '../../locales/es-US';
import localeFr from '../../locales/fr';
import localeEn from '@angular/common/locales/en';
import localeEsUS from '@angular/common/locales/es-US';
import localeFr from '@angular/common/locales/fr';
import {registerLocaleData, CurrencyPipe, DecimalPipe, PercentPipe} from '@angular/common';
import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal';

View File

@ -1,9 +1,13 @@
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 = "test",
name = "test_lib",
testonly = 1,
srcs = glob(["**/*.ts"]),
srcs = glob(
["**/*.ts"],
exclude = ["**/*_node_only_spec.ts"],
),
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
@ -18,3 +22,42 @@ ts_library(
"//packages/platform-browser/testing",
],
)
ts_library(
name = "test_node_only_lib",
testonly = 1,
srcs = glob(["**/*_node_only_spec.ts"]),
tsconfig = "//packages:tsconfig",
deps = [
":test_lib",
"//packages/compiler",
"//packages/compiler/testing",
],
)
jasmine_node_test(
name = "test",
bootstrap = ["angular_src/packages/_testing_init/init_node_spec.js"],
# dissable since tests are running but not yet passing
tags = ["manual"],
deps = [
":test_lib",
":test_node_only_lib",
"//packages/_testing_init:node",
"//packages/core",
],
)
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",
],
)