build: add npm_integration_test && angular_integration_test (#33927)
* it's tricky to get out of the runfiles tree with `bazel test` as `BUILD_WORKSPACE_DIRECTORY` is not set but I employed a trick to read the `DO_NOT_BUILD_HERE` file that is one level up from `execroot` and that contains the workspace directory. This is experimental and if `bazel test //:test.debug` fails than `bazel run` is still guaranteed to work as `BUILD_WORKSPACE_DIRECTORY` will be set in that context * test //integration:bazel_test and //integration:bazel-schematics_test exclusively * run "exclusive" and "manual" bazel-in-bazel integration tests in their own CI job as they take 8m+ to execute ``` //integration:bazel-schematics_test PASSED in 317.2s //integration:bazel_test PASSED in 167.8s ``` * Skip all integration tests that are now handled by angular_integration_test except the tests that are tracked for payload size; these are: - cli-hello-world* - hello_world__closure * add & pin @babel deps as newer versions of babel break //packages/localize/src/tools/test:test @babel/core dep had to be pinned to 7.6.4 or else //packages/localize/src/tools/test:test failed. Also //packages/localize uses @babel/generator, @babel/template, @babel/traverse & @babel/types so these deps were added to package.json as they were not being hoisted anymore from @babel/core transitive. NB: integration/hello_world__systemjs_umd test must run with systemjs 0.20.0 NB: systemjs must be at 0.18.10 for legacy saucelabs job to pass NB: With Bazel 2.0, the glob for the files to test `"integration/bazel/**"` is empty if integation/bazel is in .bazelignore. This glob worked under these conditions with 1.1.0. I did not bother testing with 1.2.x as not having integration/bazel in .bazelignore is correct. PR Close #33927
This commit is contained in:

committed by
Miško Hevery

parent
bb09cd0e41
commit
2f572772b0
222
integration/BUILD.bazel
Normal file
222
integration/BUILD.bazel
Normal file
@ -0,0 +1,222 @@
|
||||
load(":angular_integration_test.bzl", "angular_integration_test")
|
||||
|
||||
# Some integration ports must be managed manually to be unique and in other
|
||||
# cases the tests are able to select a random free port.
|
||||
#
|
||||
# Where `ng e2e` is used we pass `ng e2e --port 0` which prompts the cli
|
||||
# to select a random free port for the the e2e test. The protractor.conf is
|
||||
# automaticaly updated to use this port.
|
||||
#
|
||||
# Karma automatically finds a free port so no effort is needed there.
|
||||
#
|
||||
# The manually configured ports are as follows:
|
||||
#
|
||||
# TEST PORT CONFIGURATION
|
||||
# ==== ==== =============
|
||||
# dynamic-compiler 4201 /e2e/browser.config.json: "port": 4201
|
||||
# hello_world__closure 4202 /e2e/browser.config.json: "port": 4202
|
||||
# hello_world__systemjs_umd 4203 /bs-config.e2e.json: "port": 4203
|
||||
# i18n 4204 /e2e/browser.config.json: "port": 4204
|
||||
# ng_elements 4205 /e2e/browser.config.json: "port": 4205
|
||||
# platform-server 4206 /src/server.ts: app.listen(4206,...
|
||||
|
||||
[
|
||||
angular_integration_test(
|
||||
name = test_folder + "_test",
|
||||
test_folder = test_folder,
|
||||
)
|
||||
for test_folder in [
|
||||
"cli-hello-world",
|
||||
"cli-hello-world-ivy-compat",
|
||||
"cli-hello-world-ivy-minimal",
|
||||
"cli-hello-world-lazy",
|
||||
"cli-hello-world-lazy-rollup",
|
||||
"language_service_plugin",
|
||||
"ng_update",
|
||||
"service-worker-schema",
|
||||
"terser",
|
||||
]
|
||||
]
|
||||
|
||||
# The following tests should not be run with npm packages generated with `--config=ivy`
|
||||
[
|
||||
angular_integration_test(
|
||||
name = test_folder + "_test",
|
||||
tags = ["no-ivy-aot"],
|
||||
test_folder = test_folder,
|
||||
)
|
||||
for test_folder in [
|
||||
# `injectable-def` has .ngfactory imports:
|
||||
# ```
|
||||
# FAIL: Expected 'ngcc' to add build marker for 'esm2015' in '@angular/common'.
|
||||
# ```
|
||||
# as it is not expecting the @angular bundles to be generated with `--define=compile=aot`
|
||||
"injectable-def",
|
||||
# `ngcc` fails with:
|
||||
# ```
|
||||
# + ngc -p tsconfig-app.json
|
||||
# src/main.ts(5,34): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Error during template compile of 'AppModule'
|
||||
# Function calls are not supported in decorators but 'BrowserModule' was called.
|
||||
# ```
|
||||
"ngcc",
|
||||
# `ng_update_migrations` has golden tests failures such as:
|
||||
# ```
|
||||
# ✘ File "src/app/migration-tests/undecorated-derived-classes.ts" does not match the expected output.
|
||||
# --------------------------------------------
|
||||
# --- src/app/migration-tests/undecorated-derived-classes.ts Expected content
|
||||
# +++ src/app/migration-tests/undecorated-derived-classes.ts Actual content
|
||||
# @@ -1,50 +1,19 @@
|
||||
# -import { Directive, NgModule, NgZone, Component } from '@angular/core';
|
||||
# -import { CheckboxControlValueAccessor, NG_VALUE_ACCESSOR, NG_ASYNC_VALIDATORS } from '@angular/forms';
|
||||
# -import { BaseComponentFromOtherFile, hostBindings } from './base-component';
|
||||
# +import {Directive, NgModule, NgZone} from '@angular/core';
|
||||
# +import {CheckboxControlValueAccessor} from '@angular/forms';
|
||||
# +import {BaseComponentFromOtherFile} from './base-component';
|
||||
# ```
|
||||
"ng_update_migrations",
|
||||
# `i18n` has .ngfactory imports:
|
||||
# ```
|
||||
# $ ngc && yarn run closure && concurrently "yarn run serve" "yarn run protractor" --kill-others --success first && npm run test-locale-folder
|
||||
# src/main.ts(2,34): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-58883IJeiUMLGHRRQ/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-58883IJeiUMLGHRRQ/src/app.ts'. Please add a @NgModule annotation.
|
||||
# ```
|
||||
"i18n",
|
||||
# `ivy-i18n` fails with:
|
||||
# ```
|
||||
# ERROR in Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59999cYHm5rQoUk0v/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59999cYHm5rQoUk0v/src/app/app.module.ts'. Please add a @NgModule annotation.
|
||||
# @angular/core/src/i18n/tokens.ts(31,22): Error during template compile of 'LOCALE_ID'
|
||||
# Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler.
|
||||
# Can't resolve all parameters for AppComponent in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59999cYHm5rQoUk0v/src/app/app.component.ts: (?).
|
||||
# The pipe 'percent' could not be found ("
|
||||
# </div>
|
||||
# <p id="locale">{{ locale }}</p>
|
||||
# <p id="pipe">{{ [ERROR ->]1 | percent }} awesome</p>
|
||||
# <p id="date">{{ jan | date : 'LLLL' }}</p>
|
||||
# <h2>Here are some links to help")
|
||||
# The pipe 'date' could not be found ("
|
||||
# <p id="locale">{{ locale }}</p>
|
||||
# <p id="pipe">{{ 1 | percent }} awesome</p>
|
||||
# <p id="date">{{ [ERROR ->]jan | date : 'LLLL' }}</p>
|
||||
# <h2>Here are some links to help you start: </h2>
|
||||
# <ul>
|
||||
# ")
|
||||
# ```
|
||||
"ivy-i18n",
|
||||
# `cli-hello-world-ivy-i18n` fails with:
|
||||
# ```
|
||||
# ERROR in Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59695c6NwKC6Djcv4/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59695c6NwKC6Djcv4/src/app/app.module.ts'. Please add a @NgModule annotation.
|
||||
# @angular/core/src/i18n/tokens.ts(31,22): Error during template compile of 'LOCALE_ID'
|
||||
# Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler.
|
||||
# Can't resolve all parameters for AppComponent in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-59695c6NwKC6Djcv4/src/app/app.component.ts: (?).
|
||||
# The pipe 'percent' could not be found ("1 i18n="some:description"> Hello {{ title }}! </h1>
|
||||
# <p id="locale">{{ locale }}</p>
|
||||
# <p id="pipe">{{ [ERROR ->]1 | percent }} awesome</p>
|
||||
# <p id="date">{{ jan | date : 'LLLL' }}</p>
|
||||
# ")
|
||||
# The pipe 'date' could not be found ("
|
||||
# <p id="locale">{{ locale }}</p>
|
||||
# <p id="pipe">{{ 1 | percent }} awesome</p>
|
||||
# <p id="date">{{ [ERROR ->]jan | date : 'LLLL' }}</p>
|
||||
# ")
|
||||
# ```
|
||||
"cli-hello-world-ivy-i18n",
|
||||
# `dynamic-compiler` has .ngfactory imports:
|
||||
# ```
|
||||
# $ ngc && yarn run closure && concurrently "yarn run serve" "yarn run protractor" --kill-others --success first
|
||||
# src/main.ts(2,34): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-620291x2ZHDyIWIdL/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-620291x2ZHDyIWIdL/src/app.ts'. Please add a @NgModule annotation.
|
||||
# ```
|
||||
"dynamic-compiler",
|
||||
# `ng_elements` has .ngfactory imports:
|
||||
# ```
|
||||
# $ ngc && yarn run closure && concurrently "yarn run serve" "yarn run protractor" --kill-others --success first
|
||||
# src/main.ts(2,34): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-620291x2ZHDyIWIdL/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-620291x2ZHDyIWIdL/src/app.ts'. Please add a @NgModule annotation.
|
||||
# ```
|
||||
"ng_elements",
|
||||
# `platform-server` has .ngfactory imports:
|
||||
# ```
|
||||
# src/server.ts(15,47): error TS2307: Cannot find module './helloworld/app.server.ngfactory'.
|
||||
# src/server.ts(18,50): error TS2307: Cannot find module './transferstate/app.server.ngfactory'.
|
||||
# src/helloworld/client.ts(13,41): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# src/transferstate/client.ts(13,44): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Error during template compile of 'HelloWorldModule'
|
||||
# Function calls are not supported in decorators but 'BrowserModule' was called.
|
||||
# ```
|
||||
"platform-server",
|
||||
# `side-effects` fails on minor differences to snapshots:
|
||||
# ```
|
||||
# The following snapshots have changed:
|
||||
# Index: /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-629425HECGefnB0O7/snapshots/animations-browser/esm5.js
|
||||
# ===================================================================
|
||||
# --- /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-629425HECGefnB0O7/snapshots/animations-browser/esm5.js
|
||||
# +++ /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-629425HECGefnB0O7/snapshots/animations-browser/esm5.js
|
||||
# @@ -1,5 +1,5 @@
|
||||
# -import "tslib";
|
||||
# -
|
||||
# import "@angular/animations";
|
||||
#
|
||||
# import "@angular/core";
|
||||
# +
|
||||
# +import "tslib";
|
||||
# ```
|
||||
"side-effects",
|
||||
# `hello_world__closure` has .ngfactory imports:
|
||||
# ```
|
||||
# $ ngc && yarn run closure && concurrently "yarn run serve" "yarn run protractor" --kill-others --success first
|
||||
# src/main.ts(2,34): error TS2307: Cannot find module './app.ngfactory'.
|
||||
# Unexpected value 'BrowserModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-67554cqUv301iuuwu/node_modules/@angular/platform-browser/src/browser.d.ts' imported by the module 'AppModule in /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-67554cqUv301iuuwu/src/app.ts'. Please add a @NgModule annotation. # ```
|
||||
"hello_world__closure",
|
||||
]
|
||||
]
|
||||
|
||||
# Special cases for bazel-in-bazel tests which are tagged as "exclusive" so that they don't drain
|
||||
# all the resources on the machine when run in parallel. Also only run these tests against the
|
||||
# ViewEngine generated packages. Since these tests are "exclusive", also tag them as manual as they
|
||||
# will be run in separate CI jobs.
|
||||
angular_integration_test(
|
||||
name = "bazel_test",
|
||||
tags = [
|
||||
"exclusive",
|
||||
"manual",
|
||||
"no-ivy-aot",
|
||||
],
|
||||
test_folder = "bazel",
|
||||
)
|
||||
|
||||
angular_integration_test(
|
||||
name = "bazel-schematics_test",
|
||||
# integration/bazel-schematics uses $CI_CHROMEDRIVER_VERSION_ARG in its postinstall webdriver-manager update
|
||||
# TODO(gregmagolan): remove that dependency have that test use puppeteer as well
|
||||
configuration_env_vars = [
|
||||
"CI_CHROMEDRIVER_VERSION_ARG",
|
||||
],
|
||||
tags = [
|
||||
"exclusive",
|
||||
"manual",
|
||||
"no-ivy-aot",
|
||||
# Don't execute remotely as these test depends on the locally installed Chrome
|
||||
"no-remote-exec",
|
||||
],
|
||||
test_folder = "bazel-schematics",
|
||||
)
|
||||
|
||||
# Special case for `typings_test_ts36` test as we want to pin
|
||||
# `typescript` at version 3.6.x for that test and not link to the
|
||||
# root @npm//typescript package.
|
||||
angular_integration_test(
|
||||
name = "typings_test_ts36_test",
|
||||
pinned_npm_packages = ["typescript"],
|
||||
test_folder = "typings_test_ts36",
|
||||
)
|
||||
|
||||
# Special case for `hello_world__systemjs_umd` test as we want to pin
|
||||
# `systems` at version 0.20.2 and not link to the the root @npm//systemjs
|
||||
# which is stuck at 0.18.10 and can't be updated to 0.20.2 without
|
||||
# breaking the legacy saucelabs job.
|
||||
angular_integration_test(
|
||||
name = "hello_world__systemjs_umd_test",
|
||||
pinned_npm_packages = ["systemjs"],
|
||||
test_folder = "hello_world__systemjs_umd",
|
||||
)
|
@ -65,6 +65,35 @@ $ ./integration/run_tests.sh
|
||||
The test runner will first re-build any stale npm packages, then `cd` into each subdirectory to
|
||||
execute the test.
|
||||
|
||||
## Running integration tests under Bazel
|
||||
|
||||
The PR https://github.com/angular/angular/pull/33927 added the ability to run integration tests with Bazel. These tests can be resource intensive so it is recommended to limit the number of concurrent test jobs with the `--local_test_jobs` bazel flag.
|
||||
|
||||
Locally, if Bazel uses all of your cores to run the maximum number of integration tests in parallel then this can lead to test timeouts and flakes and freeze up your machine while these tests are running. You can limit the number of concurrent local integration tests that run with:
|
||||
|
||||
```
|
||||
yarn bazel test --local_test_jobs=<N> //integration/...
|
||||
```
|
||||
|
||||
Set a reasonable `local_test_jobs` limit for your local machine to prevent full cpu utilization during local development test runs.
|
||||
|
||||
To avoid having to specify this command line flag, you may want to include it in your `.bazelrc.user` file:
|
||||
|
||||
```
|
||||
test --local_test_jobs=<N>
|
||||
```
|
||||
|
||||
The downside of this is that this will apply to all tests and not just the resource intensive integration tests.
|
||||
|
||||
### Bazel-in-bazel integration tests
|
||||
|
||||
Two of the integration tests that run Bazel-in-Bazel are particularly resource intensive and are tagged "manual" and "exclusive". To run these tests use,
|
||||
|
||||
```
|
||||
yarn bazel test //integration:bazel_test
|
||||
yarn bazel test //integration:bazel-schematics_test
|
||||
```
|
||||
|
||||
## Browser tests
|
||||
|
||||
For integration tests we use the puppeteer provisioned version of Chrome. For both Karma and Protractor tests we set a number of browser testing flags. To avoid duplication, they will be listed and explained here and the code will reference this file for more information.
|
||||
|
153
integration/angular_integration_test.bzl
Normal file
153
integration/angular_integration_test.bzl
Normal file
@ -0,0 +1,153 @@
|
||||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
"""Angular integration testing
|
||||
"""
|
||||
|
||||
load("//tools/npm_integration_test:npm_integration_test.bzl", "npm_integration_test")
|
||||
|
||||
# The @npm packages at the root node_modules are used by integration tests
|
||||
# with `file:../../node_modules/foobar` references
|
||||
NPM_PACKAGE_ARCHIVES = [
|
||||
"check-side-effects",
|
||||
"core-js",
|
||||
"jasmine",
|
||||
"typescript",
|
||||
"rxjs",
|
||||
"systemjs",
|
||||
"tsickle",
|
||||
"tslib",
|
||||
"protractor",
|
||||
"puppeteer",
|
||||
"rollup",
|
||||
"rollup-plugin-commonjs",
|
||||
"rollup-plugin-node-resolve",
|
||||
"webdriver-manager",
|
||||
"@angular/cli",
|
||||
"@angular-devkit/build-angular",
|
||||
"@bazel/bazel",
|
||||
"@types/jasmine",
|
||||
"@types/jasminewd2",
|
||||
"@types/node",
|
||||
]
|
||||
|
||||
# The generated npm packages should ALWAYS be replaced in integration tests
|
||||
# so we pass them to the `check_npm_packages` attribute of npm_integration_test
|
||||
GENERATED_NPM_PACKAGES = [
|
||||
"@angular/animations",
|
||||
"@angular/bazel",
|
||||
"@angular/benchpress",
|
||||
"@angular/common",
|
||||
"@angular/compiler",
|
||||
"@angular/compiler-cli",
|
||||
"@angular/core",
|
||||
"@angular/elements",
|
||||
"@angular/forms",
|
||||
"@angular/http",
|
||||
"@angular/language-service",
|
||||
"@angular/localize",
|
||||
"@angular/platform-browser",
|
||||
"@angular/platform-browser-dynamic",
|
||||
"@angular/platform-server",
|
||||
"@angular/platform-webworker",
|
||||
"@angular/platform-webworker-dynamic",
|
||||
"@angular/router",
|
||||
"@angular/service-worker",
|
||||
"@angular/upgrade",
|
||||
"zone.js",
|
||||
]
|
||||
|
||||
def npm_package_archives():
|
||||
"""Function to generate pkg_tar definitions for WORKSPACE yarn_install manual_build_file_contents"""
|
||||
npm_packages_to_archive = NPM_PACKAGE_ARCHIVES
|
||||
result = """load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||
"""
|
||||
for name in npm_packages_to_archive:
|
||||
label_name = _npm_package_archive_label(name)
|
||||
last_segment_name = name if name.find("/") == -1 else name.split("/")[-1]
|
||||
result += """pkg_tar(
|
||||
name = "{label_name}",
|
||||
srcs = ["//{name}:{last_segment_name}__all_files"],
|
||||
extension = "tar.gz",
|
||||
strip_prefix = "./node_modules/{name}",
|
||||
# should not be built unless it is a dependency of another rule
|
||||
tags = ["manual"],
|
||||
)
|
||||
""".format(name = name, label_name = label_name, last_segment_name = last_segment_name)
|
||||
return result
|
||||
|
||||
def _npm_package_archive_label(package_name):
|
||||
return package_name.replace("/", "_").replace("@", "") + "_archive"
|
||||
|
||||
def _angular_integration_test(pinned_npm_packages = [], **kwargs):
|
||||
"Set defaults for the npm_integration_test common to the angular repo"
|
||||
commands = kwargs.pop("commands", None)
|
||||
if not commands:
|
||||
# By default run `yarn install` followed by `yarn test` using
|
||||
# the bazel managed hermetic version of yarn inside
|
||||
commands = [
|
||||
# Workaround https://github.com/yarnpkg/yarn/issues/2165
|
||||
# Yarn will cache file://dist URIs and not update Angular code
|
||||
"rm -rf ./.yarn_local_cache",
|
||||
"mkdir .yarn_local_cache",
|
||||
"patch-package-json",
|
||||
"$(rootpath @nodejs//:yarn_bin) install --cache-folder ./.yarn_local_cache",
|
||||
"$(rootpath @nodejs//:yarn_bin) test",
|
||||
"rm -rf ./.yarn_local_cache",
|
||||
]
|
||||
|
||||
# Complete list of npm packages to override in the test's package.json file mapped to
|
||||
# tgz archive to use for the replacement. This is the full list for all integration
|
||||
# tests. Any given integration does not need to use all of these packages.
|
||||
npm_packages = {}
|
||||
for name in NPM_PACKAGE_ARCHIVES:
|
||||
if name not in pinned_npm_packages:
|
||||
npm_packages["@npm//:" + _npm_package_archive_label(name)] = name
|
||||
for name in GENERATED_NPM_PACKAGES:
|
||||
last_segment_name = name if name.find("/") == -1 else name.split("/")[-1]
|
||||
npm_packages["//packages/%s:npm_package_archive" % last_segment_name] = name
|
||||
|
||||
npm_integration_test(
|
||||
check_npm_packages = GENERATED_NPM_PACKAGES,
|
||||
commands = commands,
|
||||
npm_packages = npm_packages,
|
||||
tags = kwargs.pop("tags", []) + [
|
||||
# `integration` tag is used for filtering out these tests from the normal
|
||||
# developer workflow
|
||||
"integration",
|
||||
# Integration do not work inside of a sandbox as they may run host applications such
|
||||
# as chrome (which is run by ng) that require access to files outside of the sandbox.
|
||||
"no-sandbox",
|
||||
],
|
||||
data = kwargs.pop("data", []) + [
|
||||
# We need the yarn_bin & yarn_files available at runtime
|
||||
"@nodejs//:yarn_bin",
|
||||
"@nodejs//:yarn_files",
|
||||
],
|
||||
# 15-minute timeout
|
||||
timeout = "long",
|
||||
# Tells bazel that this test should be allocated a large amount of memory.
|
||||
# See https://docs.bazel.build/versions/2.0.0/be/common-definitions.html#common-attributes-tests.
|
||||
size = "enormous",
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def angular_integration_test(name, test_folder, pinned_npm_packages = [], **kwargs):
|
||||
"Sets up the integration test target based on the test folder name"
|
||||
native.filegroup(
|
||||
name = "_%s_sources" % name,
|
||||
srcs = native.glob(
|
||||
include = ["%s/**" % test_folder],
|
||||
exclude = [
|
||||
"%s/node_modules/**" % test_folder,
|
||||
"%s/.yarn_local_cache/**" % test_folder,
|
||||
],
|
||||
),
|
||||
)
|
||||
_angular_integration_test(
|
||||
name = name,
|
||||
test_files = kwargs.pop("test_files", "_%s_sources" % name),
|
||||
pinned_npm_packages = pinned_npm_packages,
|
||||
**kwargs
|
||||
)
|
@ -4,9 +4,23 @@
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular",
|
||||
"@angular/animations": "file:../../dist/packages-dist/animations",
|
||||
"@angular/bazel": "file:../../dist/packages-dist/bazel",
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@bazel/bazel": "file:../../node_modules/@bazel/bazel"
|
||||
"@angular/common": "file:../../node_modules/@angular/common",
|
||||
"@angular/compiler": "file:../../node_modules/@angular/compiler",
|
||||
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",
|
||||
"@angular/core": "file:../../node_modules/@angular/core",
|
||||
"@angular/forms": "file:../../node_modules/@angular/forms",
|
||||
"@angular/language-service": "file:../../node_modules/@angular/language-service",
|
||||
"@angular/platform-browser": "file:../../node_modules/@angular/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../node_modules/@angular/platform-browser-dynamic",
|
||||
"@angular/router": "file:../../node_modules/@angular/router",
|
||||
"@bazel/bazel": "file:../../node_modules/@bazel/bazel",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"typescript": "file:../../node_modules/typescript",
|
||||
"tslib": "file:../../node_modules/tslib"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./test.sh"
|
||||
|
@ -2,6 +2,17 @@
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
# sedi makes `sed -i` work on both OSX & Linux
|
||||
# See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd
|
||||
function sedi () {
|
||||
case $(uname) in
|
||||
Darwin*) sedi=('-i' '') ;;
|
||||
*) sedi='-i' ;;
|
||||
esac
|
||||
|
||||
sed "${sedi[@]}" "$@"
|
||||
}
|
||||
|
||||
function installLocalPackages() {
|
||||
# Install Angular packages that are built locally from HEAD.
|
||||
# This also gets around the bug whereby yarn caches local `file://` urls.
|
||||
@ -13,17 +24,24 @@ function installLocalPackages() {
|
||||
)
|
||||
local local_packages=()
|
||||
for package in "${packages[@]}"; do
|
||||
local_packages+=("@angular/${package}@file:${pwd}/../../../dist/packages-dist/${package}")
|
||||
local_packages+=("@angular/${package}@file:${pwd}/../node_modules/@angular/${package}")
|
||||
done
|
||||
|
||||
# keep typescript, tslib, and @types/node versions in sync with the ones used in this repo
|
||||
local_packages+=("typescript@file:${pwd}/../../../node_modules/typescript")
|
||||
local_packages+=("tslib@file:${pwd}/../../../node_modules/tslib")
|
||||
local_packages+=("@types/node@file:${pwd}/../../../node_modules/@types/node")
|
||||
local_packages+=("typescript@file:${pwd}/../node_modules/typescript")
|
||||
local_packages+=("tslib@file:${pwd}/../node_modules/tslib")
|
||||
local_packages+=("@types/node@file:${pwd}/../node_modules/@types/node")
|
||||
|
||||
yarn add --ignore-scripts --silent "${local_packages[@]}"
|
||||
}
|
||||
|
||||
function patchKarmaConfForHeadless() {
|
||||
sedi "s#browsers\: \['Chrome'\],#customLaunchers\: \{ ChromeHeadlessNoSandbox\: \{ base\: 'ChromeHeadless', flags\: \['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'\] \} \}, browsers\: \['ChromeHeadlessNoSandbox'\],#" ./karma.conf.js
|
||||
}
|
||||
|
||||
function patchProtractorConfForHeadless() {
|
||||
sedi "s#browserName\: 'chrome'#browserName\: 'chrome', chromeOptions\: \{ args: \['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'\] \},#" ./e2e/protractor.conf.js
|
||||
}
|
||||
|
||||
function testBazel() {
|
||||
# Set up
|
||||
@ -33,6 +51,8 @@ function testBazel() {
|
||||
# Create project
|
||||
ng new demo --collection=@angular/bazel --routing --skip-git --skip-install --style=scss
|
||||
cd demo
|
||||
patchKarmaConfForHeadless
|
||||
patchProtractorConfForHeadless
|
||||
installLocalPackages
|
||||
ng generate component widget --style=css
|
||||
ng build
|
||||
@ -52,13 +72,13 @@ function testNonBazel() {
|
||||
# disable CLI's version check (if version is 0.0.0, then no version check happens)
|
||||
yarn --cwd node_modules/@angular/cli version --new-version 0.0.0 --no-git-tag-version
|
||||
# re-add build-angular
|
||||
yarn add --dev file:../../../node_modules/@angular-devkit/build-angular
|
||||
yarn add --dev file:../node_modules/@angular-devkit/build-angular
|
||||
# TODO: Find a way to use the Chrome version provided by `puppeteer` as the rest of the
|
||||
# integration projects. See https://github.com/angular/angular/pull/35049 for details.
|
||||
yarn webdriver-manager update --gecko=false --standalone=false --versions.chrome=79.0.3945.130;
|
||||
ng build --progress=false
|
||||
ng test --progress=false --watch=false
|
||||
ng e2e --configuration=production --webdriver-update=false
|
||||
ng e2e --port 0 --configuration=production --webdriver-update=false
|
||||
}
|
||||
|
||||
testBazel
|
||||
|
@ -4,7 +4,7 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e",
|
||||
"e2e": "ng e2e --port 0",
|
||||
"lint": "ng lint",
|
||||
"ng": "ng",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
|
||||
@ -31,8 +31,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.4.6",
|
||||
"@types/jasminewd2": "2.0.6",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"codelyzer": "5.2.0",
|
||||
"jasmine-core": "3.5.0",
|
||||
|
@ -4,13 +4,13 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e",
|
||||
"e2e": "ng e2e --port 0",
|
||||
"lint": "ng lint",
|
||||
"ng": "ng",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
|
||||
"start": "ng serve",
|
||||
"pretest": "ng version",
|
||||
"test": "ng e2e --prod && ng xi18n && yarn translate && ng e2e --configuration fr && ng e2e --configuration de",
|
||||
"test": "ng e2e --port 0 --prod && ng xi18n && yarn translate && ng e2e --port 0 --configuration fr && ng e2e --port 0 --configuration de",
|
||||
"translate": "cp src/locale/messages.xlf src/locale/messages.fr.xlf && cp src/locale/messages.xlf src/locale/messages.de.xlf && sed -i.bak -e 's/source>/target>/g' -e 's/Hello/Bonjour/' src/locale/messages.fr.xlf && sed -i.bak -e 's/source>/target>/g' -e 's/Hello/Hallo/' src/locale/messages.de.xlf",
|
||||
"serve": "serve --no-clipboard --listen 4200"
|
||||
},
|
||||
@ -35,8 +35,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.4.4",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"codelyzer": "5.2.0",
|
||||
"jasmine-core": "3.5.0",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e",
|
||||
"e2e": "ng e2e --port 0",
|
||||
"lint": "ng lint",
|
||||
"ng": "ng",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
|
||||
@ -31,8 +31,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.4.6",
|
||||
"@types/jasminewd2": "2.0.6",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"codelyzer": "5.2.0",
|
||||
"jasmine-core": "3.5.0",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e --prod",
|
||||
"e2e": "ng e2e --port 0 --prod",
|
||||
"test": "yarn e2e && yarn build && node check-output-for-ngdevmode.js",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
|
||||
},
|
||||
@ -18,7 +18,7 @@
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/router": "file:../../dist/packages-dist/router",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
"tslib": "1.10.0",
|
||||
"tslib": "file:../../node_modules/tslib",
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -26,9 +26,9 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/node": "10.14.21",
|
||||
"@types/jasmine": "3.4.4",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"codelyzer": "5.1.2",
|
||||
"jasmine-core": "3.5.0",
|
||||
"jasmine-spec-reporter": "4.2.1",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e --prod",
|
||||
"e2e": "ng e2e --port 0 --prod",
|
||||
"test": "yarn e2e && yarn build && node check-output-for-ngdevmode.js",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
|
||||
},
|
||||
@ -18,7 +18,7 @@
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/router": "file:../../dist/packages-dist/router",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
"tslib": "1.10.0",
|
||||
"tslib": "file:../../node_modules/tslib",
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -26,9 +26,9 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/node": "10.14.21",
|
||||
"@types/jasmine": "3.4.4",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"codelyzer": "5.1.2",
|
||||
"jasmine-core": "3.5.0",
|
||||
"jasmine-spec-reporter": "4.2.1",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"pretest": "ng version",
|
||||
"test": "ng test && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"e2e": "ng e2e --port 0",
|
||||
"postinstall": "ngcc --properties es2015 --create-ivy-entry-points"
|
||||
},
|
||||
"private": true,
|
||||
@ -30,8 +30,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.4.6",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"codelyzer": "5.2.0",
|
||||
"jasmine-core": "3.5.0",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"open": false,
|
||||
"logLevel": "silent",
|
||||
"port": 8080,
|
||||
"port": 4201,
|
||||
"server": {
|
||||
"baseDir": ".",
|
||||
"routes": {
|
||||
|
@ -13,7 +13,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:8080/',
|
||||
// Port comes from lite-server config `/e2e/browser.config.json` `"port": 4201`
|
||||
baseUrl: 'http://localhost:4201/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@ const path = require('path');
|
||||
const minimist = require('minimist');
|
||||
|
||||
// Parsed command line arguments.
|
||||
const {shardIndex, maxShards} = minimist(process.argv.slice(2));
|
||||
const {_, shardIndex, maxShards} = minimist(process.argv.slice(2));
|
||||
|
||||
// Ensure that all CLI options are set properly.
|
||||
if (shardIndex == null) {
|
||||
@ -32,46 +32,11 @@ if (shardIndex == null) {
|
||||
} else if (maxShards == null) {
|
||||
throw new Error('The "--maxShards" option has not been specified.');
|
||||
}
|
||||
|
||||
// List of all integration tests that are available.
|
||||
const integrationTests = fs.readdirSync(__dirname).filter(
|
||||
testName => fs.statSync(path.join(__dirname, testName)).isDirectory());
|
||||
|
||||
// Manual test shards which aren't computed automatically. This is helpful when a specific
|
||||
// set of integration test takes up *way* more time than all other tests, and we want to
|
||||
// balance out the duration for all specific shards.
|
||||
const manualTestShards = [
|
||||
// The first shard should only run the bazel integration tests because these take up
|
||||
// a lot of time and shouldn't be split up automatically.
|
||||
['bazel', 'bazel-schematics']
|
||||
];
|
||||
|
||||
// Tests which haven't been assigned manually to a shard. These tests will be automatically
|
||||
// split across the remaining available shards.
|
||||
const unassignedTests = stripManualOverrides(integrationTests, manualTestShards);
|
||||
|
||||
if (manualTestShards.length === maxShards && unassignedTests.length) {
|
||||
throw new Error(
|
||||
`Tests have been specified manually for all available shards, but there were ` +
|
||||
`integration tests which haven't been specified and won't run right now. Missing ` +
|
||||
`tests: ${unassignedTests.join(', ')}`)
|
||||
} else if (manualTestShards.length > maxShards) {
|
||||
throw new Error(
|
||||
`Too many manual shards have been specified. Increase the amount of maximum shards.`);
|
||||
if (shardIndex >= maxShards) {
|
||||
throw new Error('shardIndex out of bounds');
|
||||
}
|
||||
|
||||
// In case the shard for the current index has been specified manually, we just output
|
||||
// the tests for the manual shard.
|
||||
if (manualTestShards[shardIndex]) {
|
||||
printTestNames(manualTestShards[shardIndex]);
|
||||
} else {
|
||||
const amountManualShards = manualTestShards.length;
|
||||
// In case there isn't a manual shard specified for this shard index, we just compute the
|
||||
// tests for this shard. Note that we need to subtract the amount of manual shards because
|
||||
// we need to split up the unassigned tests across the remaining available shards.
|
||||
printTestNames(getTestsForShardIndex(
|
||||
unassignedTests, shardIndex - amountManualShards, maxShards - amountManualShards));
|
||||
}
|
||||
printTestNames(getTestsForShardIndex(_, shardIndex, maxShards));
|
||||
|
||||
/**
|
||||
* Splits the specified tests into a limited amount of shards and returns the tests that should
|
||||
@ -82,16 +47,6 @@ function getTestsForShardIndex(tests, shardIndex, maxShards) {
|
||||
return tests.filter((n, index) => index % maxShards === shardIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips all manual tests from the list of integration tests. This is necessary because
|
||||
* when computing the shards automatically we don't want to include manual tests again. This
|
||||
* would mean that CircleCI runs some integration tests multiple times.
|
||||
*/
|
||||
function stripManualOverrides(integrationTests, manualShards) {
|
||||
const allManualTests = manualShards.reduce((res, manualTests) => res.concat(manualTests), []);
|
||||
return integrationTests.filter(testName => !allManualTests.includes(testName))
|
||||
}
|
||||
|
||||
/** Prints the specified test names to the stdout. */
|
||||
function printTestNames(testNames) {
|
||||
// Print the test names joined with spaces because this allows Bash to easily convert the output
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"open": false,
|
||||
"logLevel": "silent",
|
||||
"port": 8080,
|
||||
"port": 4202,
|
||||
"server": {
|
||||
"baseDir": "src",
|
||||
"routes": {
|
||||
|
@ -13,7 +13,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:8080/',
|
||||
// Port comes from lite-server config `/e2e/browser.config.json` `"port": 4202`
|
||||
baseUrl: 'http://localhost:4202/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../built/e2e",
|
||||
"types": ["jasmine"],
|
||||
"types": ["jasmine", "jasminewd2"],
|
||||
// TODO(alexeagle): was required for Protractor 4.0.11
|
||||
"skipLibCheck": true
|
||||
}
|
||||
|
@ -16,11 +16,13 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
"puppeteer": "file:../../node_modules/puppeteer"
|
||||
"puppeteer": "file:../../node_modules/puppeteer",
|
||||
"tsickle": "file:../../node_modules/tsickle"
|
||||
},
|
||||
"//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update",
|
||||
"resolutions": {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
{
|
||||
"open": false,
|
||||
"logLevel": "silent",
|
||||
"port": 8000,
|
||||
"port": 4203,
|
||||
"server": {
|
||||
"baseDir": "src",
|
||||
"routes": {
|
||||
|
@ -4,8 +4,6 @@
|
||||
"lib": [ "es2015", "dom" ],
|
||||
"noImplicitAny": true,
|
||||
"skipLibCheck": true,
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
"types": ["jasmine", "jasminewd2"]
|
||||
}
|
||||
}
|
@ -23,7 +23,8 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
|
@ -13,7 +13,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:8000/',
|
||||
// Port comes from lite-serve config `/bs-config.e2e.json` `"port": 4203`
|
||||
baseUrl: 'http://localhost:4203/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true,
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"open": false,
|
||||
"logLevel": "silent",
|
||||
"port": 8080,
|
||||
"port": 4204,
|
||||
"server": {
|
||||
"baseDir": "src",
|
||||
"routes": {
|
||||
|
@ -13,7 +13,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:8080/',
|
||||
// Port comes from lite-server config `/e2e/browser.config.json` `"port": 4204`
|
||||
baseUrl: 'http://localhost:4204/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../built/e2e",
|
||||
"types": ["jasmine"],
|
||||
"types": ["jasmine", "jasminewd2"],
|
||||
// TODO(alexeagle): was required for Protractor 4.0.11
|
||||
"skipLibCheck": true
|
||||
}
|
||||
|
@ -17,11 +17,13 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
"puppeteer": "file:../../node_modules/puppeteer"
|
||||
"puppeteer": "file:../../node_modules/puppeteer",
|
||||
"tsickle": "file:../../node_modules/tsickle"
|
||||
},
|
||||
"//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update",
|
||||
"resolutions": {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor"
|
||||
|
@ -4,7 +4,7 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "ng build --prod",
|
||||
"e2e": "ng e2e",
|
||||
"e2e": "ng e2e --port 0",
|
||||
"lint": "ng lint",
|
||||
"ng": "ng",
|
||||
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
|
||||
@ -49,8 +49,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.4.4",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"codelyzer": "5.2.0",
|
||||
"jasmine-core": "3.5.0",
|
||||
|
@ -6,6 +6,7 @@
|
||||
"dependencies": {
|
||||
"@angular/core": "file:../../dist/packages-dist/core",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"jasmine": "file:../../node_modules/jasmine",
|
||||
"typescript": "file:../../node_modules/typescript"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"open": false,
|
||||
"logLevel": "silent",
|
||||
"port": 8080,
|
||||
"port": 4205,
|
||||
"server": {
|
||||
"baseDir": "src",
|
||||
"routes": {
|
||||
|
@ -13,7 +13,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:8080/',
|
||||
// Port comes from lite-server config `/e2e/browser.config.json` `"port": 4205`
|
||||
baseUrl: 'http://localhost:4205/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../built/e2e",
|
||||
"types": ["jasmine"],
|
||||
"types": ["jasmine", "jasminewd2"],
|
||||
// TODO(alexeagle): was required for Protractor 4.0.11
|
||||
"skipLibCheck": true
|
||||
}
|
||||
|
@ -17,11 +17,13 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
"puppeteer": "file:../../node_modules/puppeteer"
|
||||
"puppeteer": "file:../../node_modules/puppeteer",
|
||||
"tsickle": "file:../../node_modules/tsickle"
|
||||
},
|
||||
"//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update",
|
||||
"resolutions": {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,8 +28,8 @@
|
||||
"@angular/cli": "file:../../node_modules/@angular/cli",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/language-service": "file:../../dist/packages-dist/language-service",
|
||||
"@types/jasmine": "3.3.16",
|
||||
"@types/jasminewd2": "2.0.6",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"chalk": "2.4.2",
|
||||
"diff": "4.0.1",
|
||||
|
@ -21,7 +21,7 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"concurrently": "3.4.0",
|
||||
"lite-server": "2.2.2",
|
||||
"protractor": "file:../../node_modules/protractor"
|
||||
|
@ -184,6 +184,9 @@ assertSucceeded "Expected 'ngcc' to log 'Compiling'."
|
||||
# Can it compile `@angular/platform-server` in UMD + typings without errors?
|
||||
# (The CLI prefers the `main` property (which maps to UMD) over `module` when compiling `@angular/platform-server`.
|
||||
# See https://github.com/angular/angular-cli/blob/e36853338/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/server.ts#L34)
|
||||
if [[ -z "$cache" ]]; then
|
||||
cache=".yarn_local_cache"
|
||||
fi
|
||||
rm -rf node_modules/@angular/platform-server && \
|
||||
yarn install --cache-folder $cache --check-files && \
|
||||
test -d node_modules/@angular/platform-server
|
||||
|
@ -18,7 +18,8 @@ exports.config = {
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:9876/',
|
||||
// Port comes from express config `/src/server.ts` `app.listen(4206,...`
|
||||
baseUrl: 'http://localhost:4206/',
|
||||
framework: 'jasmine',
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../built/e2e",
|
||||
"types": ["jasmine"],
|
||||
"types": ["jasmine", "jasminewd2"],
|
||||
// TODO(alexeagle): was required for Protractor 4.0.11
|
||||
"skipLibCheck": true
|
||||
}
|
||||
|
@ -22,7 +22,8 @@
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "2.5.41",
|
||||
"@types/jasmine": "file:../../node_modules/@types/jasmine",
|
||||
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
|
||||
"@types/node": "file:../../node_modules/@types/node",
|
||||
"babel-core": "6.26.3",
|
||||
"babel-loader": "6.4.1",
|
||||
@ -31,6 +32,7 @@
|
||||
"protractor": "file:../../node_modules/protractor",
|
||||
"puppeteer": "file:../../node_modules/puppeteer",
|
||||
"raw-loader": "0.5.1",
|
||||
"tsickle": "file:../../node_modules/tsickle",
|
||||
"webpack": "2.7.0"
|
||||
},
|
||||
"//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update",
|
||||
|
@ -41,4 +41,4 @@ app.get('/favicon.ico', (req, res) => { res.send(''); });
|
||||
app.get('/helloworld', render(HelloWorldServerModuleNgFactory, helloworld));
|
||||
app.get('/transferstate', render(TransferStateServerModuleNgFactory, transferstate));
|
||||
|
||||
app.listen(9876, function() { console.log('Server listening on port 9876!'); });
|
||||
app.listen(4206, function() { console.log('Server listening on port 4206!'); });
|
||||
|
@ -9,7 +9,12 @@ cd "$(dirname "$0")"
|
||||
|
||||
# basedir is the workspace root
|
||||
readonly basedir=$(pwd)/..
|
||||
readonly bazel_bin=$(yarn bin)/bazel
|
||||
|
||||
# Skip all integration tests that are now handled by angular_integration_test except
|
||||
# the tests that are tracked for payload size; these are:
|
||||
# - cli-hello-world*
|
||||
# - hello_world__closure
|
||||
readonly TEST_DIRS=$(find $(ls) -maxdepth 0 -type d \( -name "cli-hello-world*" -or -name "hello_world__closure" \))
|
||||
|
||||
# When running on the CI, we track the payload size of various integration output files. Also
|
||||
# we shard tests across multiple CI job instances. The script needs to be run with a shard index
|
||||
@ -18,11 +23,11 @@ readonly bazel_bin=$(yarn bin)/bazel
|
||||
if $CI; then
|
||||
source ${basedir}/scripts/ci/payload-size.sh
|
||||
|
||||
SHARD_INDEX=${1:?"No shard index has been specified."}
|
||||
MAX_SHARDS=${2:?"The maximum amount of shards has not been specified."}
|
||||
readonly SHARD_INDEX=${1:?"No shard index has been specified."}
|
||||
readonly MAX_SHARDS=${2:?"The maximum amount of shards has not been specified."}
|
||||
|
||||
# Determines the tests that need to be run for this shard index.
|
||||
TEST_DIRS=$(node ./get-sharded-tests.js --shardIndex ${SHARD_INDEX} --maxShards ${MAX_SHARDS})
|
||||
readonly RUN_TESTS=$(node ./get-sharded-tests.js --shardIndex ${SHARD_INDEX} --maxShards ${MAX_SHARDS} ${TEST_DIRS})
|
||||
|
||||
# NB: we don't run build-packages-dist.js because we expect that it was done
|
||||
# by an earlier job in the CircleCI workflow.
|
||||
@ -33,9 +38,11 @@ else
|
||||
|
||||
# If we aren't running on CircleCI, we do not shard tests because this would be the job of
|
||||
# Bazel eventually. For now, we just run all tests sequentially when running locally.
|
||||
TEST_DIRS=$(ls | grep -v node_modules)
|
||||
readonly RUN_TESTS=${TEST_DIRS}
|
||||
fi
|
||||
|
||||
echo "Running integration tests: ${RUN_TESTS}"
|
||||
|
||||
# Workaround https://github.com/yarnpkg/yarn/issues/2165
|
||||
# Yarn will cache file://dist URIs and not update Angular code
|
||||
export readonly cache=.yarn_local_cache
|
||||
@ -46,11 +53,14 @@ rm_cache
|
||||
mkdir $cache
|
||||
trap rm_cache EXIT
|
||||
|
||||
for testDir in ${TEST_DIRS}; do
|
||||
for testDir in ${RUN_TESTS}; do
|
||||
[[ -d "$testDir" ]] || continue
|
||||
echo "#################################"
|
||||
|
||||
echo ""
|
||||
echo "######################################################################"
|
||||
echo "Running integration test $testDir"
|
||||
echo "#################################"
|
||||
echo "######################################################################"
|
||||
|
||||
(
|
||||
cd $testDir
|
||||
rm -rf dist
|
||||
|
@ -11,6 +11,7 @@
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
"terser": "3.17.0",
|
||||
"typescript": "file:../../node_modules/typescript",
|
||||
"zone.js": "file:../../dist/zone.js-dist/zone.js"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/typings_test_ts36/",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"rootDir": ".",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
|
Reference in New Issue
Block a user