This commit makes the integration test for bazel-schematics more robust by removing package.json.replace. Instead of replacing the file, the test script now just overrides Angular packages with the local ones. This commit also fixes running the test locally by providing default argument for CI_CHROMEDRIVER_VERSION_ARG. PR Close #28872
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eux -o pipefail
|
|
|
|
function installLocalPackages() {
|
|
# Install Angular packages that are built locally from HEAD.
|
|
# This also gets around the bug whereby yarn caches local `file://` urls.
|
|
# See https://github.com/yarnpkg/yarn/issues/2165
|
|
readonly pwd=$(pwd)
|
|
readonly packages=(
|
|
animations common compiler core forms platform-browser
|
|
platform-browser-dynamic router bazel compiler-cli language-service upgrade
|
|
)
|
|
local local_packages=()
|
|
for package in "${packages[@]}"; do
|
|
local_packages+=("@angular/${package}@file:${pwd}/../../../dist/packages-dist/${package}")
|
|
done
|
|
yarn add "${local_packages[@]}"
|
|
}
|
|
|
|
function testBazel() {
|
|
# Set up
|
|
bazel version
|
|
ng version
|
|
rm -rf demo
|
|
# Create project
|
|
ng new demo --collection=@angular/bazel --defaults --skip-git --skip-install --style=scss
|
|
cd demo
|
|
installLocalPackages
|
|
yarn webdriver-manager update --gecko=false --standalone=false ${CI_CHROMEDRIVER_VERSION_ARG:---versions.chrome 2.45}
|
|
ng generate component widget --style=css
|
|
ng build
|
|
ng test
|
|
ng e2e
|
|
}
|
|
|
|
function testNonBazel() {
|
|
# Replace angular.json that uses Bazel builder with the default generated by CLI
|
|
mv ./angular.json.bak ./angular.json
|
|
mv ./tsconfig.json.bak ./tsconfig.json
|
|
rm -rf dist src/main.dev.ts src/main.prod.ts
|
|
ng build --progress=false
|
|
ng test --progress=false --watch=false
|
|
ng e2e --configuration=production --webdriver-update=false
|
|
}
|
|
|
|
testBazel
|
|
testNonBazel
|