Skip to content

Commit

Permalink
fix(bazel): Set module_name and enable ng test
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.
  • Loading branch information
Keen Yee Liau committed Dec 17, 2018
1 parent d132bae commit 2b2e3b8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 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
32 changes: 16 additions & 16 deletions integration/bazel/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
# yarn lockfile v1


"@bazel/bazel-darwin_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.18.0.tgz#bab437605a702279d42f59caa4741bb327eb7dbc"
integrity sha512-um2OzgLL2Gd/W6joOpvrSTcqpnupliPNpwe/uE7sB0huBSJ/4Im0w2IlCTI6C7OfgMcbpUj4YxgUa9T6u6WY6w==
"@bazel/bazel-darwin_x64@0.20.0":
version "0.20.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.20.0.tgz#648d61c32a3c5fccb7bf70b753071b6e54b11f21"
integrity sha512-zeoeVK504341GfnaxdaB4pFzQV0YOK1HLiYj3/ocamPFxAJRh9abvKB8iOpqD5Oal0j7VsINxnXCjovp9a4urA==

"@bazel/bazel-linux_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.18.0.tgz#0c02b2404ec95c180e17615cc7079ee07df48a69"
integrity sha512-Rq8X8bL6SgQvbOHnfPhSgF6hp+f6Fbt2w6pRmBlFvV1J+CeUyrSrrRXfnnO1bjIuq05Ur3mV8ULA0qK6rtA5lQ==
"@bazel/bazel-linux_x64@0.20.0":
version "0.20.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.20.0.tgz#2568628a0d0b85dcc69d0ab701b1d6e10551357d"
integrity sha512-PpHzoEqfXty8dc1/p1tVFXtbPyrE1n0N79QmYePjJ5mJMyW7uBF/zV4IajYY8+IpJEcDVq5v4BavSexOmVJRmA==

"@bazel/bazel-win32_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.18.0.tgz#aa4575fb00066dcf59a6d464971774dea6a0bafd"
integrity sha512-U2TbfK8B7dc3JqXSFwj2oXCQrxEaSzCCUkAHjAOIGOKzx/HLKIKs+NJj9IQkLLr7BsMU+Qqzo8aqo11E+Vs+aA==
"@bazel/bazel-win32_x64@0.20.0":
version "0.20.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.20.0.tgz#af7d041dae4c066e7aa8618949e2de1aad07495e"
integrity sha512-3bqHXFBvLnbvNzr1KCQ1zryTYvHMoQffaWVekbckgPyT2VPEj3abuB91+DrRYmZdPjcgPYnjnyanxZHDkKuF2g==

"@bazel/bazel@file:../../node_modules/@bazel/bazel":
version "0.18.0"
version "0.20.0"
optionalDependencies:
"@bazel/bazel-darwin_x64" "0.18.0"
"@bazel/bazel-linux_x64" "0.18.0"
"@bazel/bazel-win32_x64" "0.18.0"
"@bazel/bazel-darwin_x64" "0.20.0"
"@bazel/bazel-linux_x64" "0.20.0"
"@bazel/bazel-win32_x64" "0.20.0"
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 2b2e3b8

Please sign in to comment.