fix(bazel): Set module_name and enable ng test (#27715)
Relative imports in Typescript files only work when module_name is defined in ts_library (when run in Node.js). See issue https://github.com/bazelbuild/rules_typescript/issues/360 With that fixed, `ng test` now works. `ng build` requires `node_modules` to be available in the project directory, so it's not usable yet. Running `yarn` in project directory does not work because of postinstall version check. PR Close #27715
This commit is contained in:
parent
c986d3dcf4
commit
85866defa4
|
@ -9,15 +9,13 @@ function test() {
|
||||||
# Create project
|
# Create project
|
||||||
ng new demo --collection=@angular/bazel --defaults --skip-git
|
ng new demo --collection=@angular/bazel --defaults --skip-git
|
||||||
cd demo
|
cd demo
|
||||||
# TODO(kyliau): Use bazel commands directly for now. Once 7.1.4 is out we can
|
|
||||||
# switch to use builders (ng build and ng test)
|
|
||||||
# Run build
|
# Run build
|
||||||
|
# TODO(kyliau): Use `bazel build` for now. Running `ng build` requires
|
||||||
|
# node_modules to be available in project directory.
|
||||||
bazel build //src:bundle
|
bazel build //src:bundle
|
||||||
# Run test
|
# Run test
|
||||||
bazel test \
|
ng test
|
||||||
//src:test \
|
ng e2e
|
||||||
//e2e:devserver_test \
|
|
||||||
//e2e:prodserver_test
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test
|
test
|
||||||
|
|
|
@ -20,6 +20,7 @@ ts_library(
|
||||||
data = [
|
data = [
|
||||||
"schema.json",
|
"schema.json",
|
||||||
],
|
],
|
||||||
|
module_name = "@angular/bazel/src/builders",
|
||||||
deps = [
|
deps = [
|
||||||
"@ngdeps//@angular-devkit/architect",
|
"@ngdeps//@angular-devkit/architect",
|
||||||
"@ngdeps//@angular-devkit/core",
|
"@ngdeps//@angular-devkit/core",
|
||||||
|
|
|
@ -12,7 +12,10 @@ ts_library(
|
||||||
"@npm//@types/node",
|
"@npm//@types/node",
|
||||||
"@npm//jasmine",
|
"@npm//jasmine",
|
||||||
"@npm//protractor",
|
"@npm//protractor",
|
||||||
]
|
],
|
||||||
|
data = [
|
||||||
|
"//:tsconfig.json",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
protractor_web_test_suite(
|
protractor_web_test_suite(
|
||||||
|
|
Loading…
Reference in New Issue