Skip to content

Commit

Permalink
fix(bazel): Set module_name and enable ng test (angular#27715)
Browse files Browse the repository at this point in the history
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 angular#27715
  • Loading branch information
Keen Yee Liau authored and ngfelixl committed Jan 27, 2019
1 parent 7770740 commit 5ff4590
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 4 additions & 6 deletions integration/bazel-schematics/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ function test() {
# Create project
ng new demo --collection=@angular/bazel --defaults --skip-git
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
# TODO(kyliau): Use `bazel build` for now. Running `ng build` requires
# node_modules to be available in project directory.
bazel build //src:bundle
# Run test
bazel test \
//src:test \
//e2e:devserver_test \
//e2e:prodserver_test
ng test
ng e2e
}

test
1 change: 1 addition & 0 deletions packages/bazel/src/builders/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ts_library(
data = [
"schema.json",
],
module_name = "@angular/bazel/src/builders",
deps = [
"@ngdeps//@angular-devkit/architect",
"@ngdeps//@angular-devkit/core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ts_library(
"@npm//@types/node",
"@npm//jasmine",
"@npm//protractor",
]
],
data = [
"//:tsconfig.json",
],
)

protractor_web_test_suite(
Expand Down

0 comments on commit 5ff4590

Please sign in to comment.