Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/material-moment-adapter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -11,14 +11,37 @@ 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
# enabled.
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"],
Expand Down
7 changes: 7 additions & 0 deletions src/material-moment-adapter/require-config.js
Original file line number Diff line number Diff line change
@@ -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'
}
});