mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: run moment adapter tests with bazel (#14687)
This commit is contained in:
committed by
mmalerba
parent
d22f48c742
commit
ac85230db3
@@ -1,6 +1,6 @@
|
||||
package(default_visibility=["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_package")
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_package", "ng_web_test_suite", "ng_test_library")
|
||||
load("//:packages.bzl", "ROLLUP_GLOBALS")
|
||||
|
||||
ng_module(
|
||||
@@ -11,7 +11,6 @@ ng_module(
|
||||
"@angular//packages/core",
|
||||
"@matdeps//moment",
|
||||
"//src/lib/core",
|
||||
"//src/lib/testing",
|
||||
],
|
||||
# Explicitly specify the tsconfig that is also used by Gulp. We need to explicitly use this
|
||||
# tsconfig because in order to import Moment with TypeScript, we need some special options
|
||||
@@ -19,6 +18,30 @@ ng_module(
|
||||
tsconfig = ":tsconfig-build.json",
|
||||
)
|
||||
|
||||
ng_test_library(
|
||||
name = "moment_adapter_test_sources",
|
||||
srcs = glob(["**/*.spec.ts"]),
|
||||
deps = [
|
||||
"//src/lib/core",
|
||||
"//src/lib/testing",
|
||||
"@matdeps//moment",
|
||||
":material-moment-adapter",
|
||||
],
|
||||
)
|
||||
|
||||
ng_web_test_suite(
|
||||
name = "unit_tests",
|
||||
deps = [
|
||||
":require-config.js",
|
||||
":moment_adapter_test_sources"
|
||||
],
|
||||
# We need to load Moment statically since it is not a named AMD module and needs to
|
||||
# be manually configured through "require.js" which is used by "ts_web_test_suite".
|
||||
static_files = [
|
||||
"@matdeps//moment",
|
||||
],
|
||||
)
|
||||
|
||||
ng_package(
|
||||
name = "npm_package",
|
||||
srcs = ["package.json"],
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Require.js is being used by the karma bazel rules and needs to be configured to properly
|
||||
// load AMD modules which are not explicitly named in their output bundle.
|
||||
require.config({
|
||||
paths: {
|
||||
'moment': '/base/matdeps/node_modules/moment/min/moment-with-locales.min'
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user