build: add new integration tests & bazel-in-bazel tests to … glob (#33927)

Move bazel-in-bazel them to test job & increase it is 2xlarge+. test_integration_bazel is removed. Overall CI credit usage is reduced.

test: include ng_elements_schematics in legacy integration tests temporarily

This test was recently added and use a new pattern that doesn't work with npm_integration_test out of the box. It needs some refactoring to work. Left a TODO for this

PR Close #33927
This commit is contained in:
Greg Magolan 2020-02-14 17:23:49 -08:00 committed by Miško Hevery
parent 983e487a8f
commit 40ae89e3bf
5 changed files with 49 additions and 191 deletions

View File

@ -27,6 +27,7 @@ integration/injectable-def/node_modules
integration/ivy-i18n/node_modules
integration/language_service_plugin/node_modules
integration/ng_elements/node_modules
integration/ng_elements_schematics/node_modules
integration/ng_update/node_modules
integration/ng_update_migrations/node_modules
integration/ngcc/node_modules
@ -35,6 +36,7 @@ integration/service-worker-schema/node_modules
integration/side-effects/node_modules
integration/terser/node_modules
integration/typings_test_ts36/node_modules
integration/typings_test_ts37/node_modules
integration/cli-hello-world/.yarn_local_cache
integration/cli-hello-world-ivy-compat/.yarn_local_cache
integration/cli-hello-world-ivy-i18n/.yarn_local_cache
@ -49,6 +51,7 @@ integration/injectable-def/.yarn_local_cache
integration/ivy-i18n/.yarn_local_cache
integration/language_service_plugin/.yarn_local_cache
integration/ng_elements/.yarn_local_cache
integration/ng_elements_schematics/.yarn_local_cache
integration/ng_update/.yarn_local_cache
integration/ng_update_migrations/.yarn_local_cache
integration/ngcc/.yarn_local_cache
@ -57,4 +60,5 @@ integration/service-worker-schema/.yarn_local_cache
integration/side-effects/.yarn_local_cache
integration/terser/.yarn_local_cache
integration/typings_test_ts36/.yarn_local_cache
integration/typings_test_ts37/.yarn_local_cache
packages/bazel/node_modules

View File

@ -298,7 +298,7 @@ jobs:
# as they require network access for yarn install), this test is running out of memory
# consistently with the xlarge machine.
# TODO: switch back to xlarge once integration tests are running on remote-exec
resource_class: 2xlarge
resource_class: 2xlarge+
steps:
- custom_attach_workspace
- init_environment
@ -308,21 +308,6 @@ jobs:
command: yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only
no_output_timeout: 20m
test_integration_bazel:
executor:
# Needed because the //integration:bazel-schematics_test test expect Chrome to be installed
name: browsers-executor
resource_class: xlarge
steps:
- custom_attach_workspace
- init_environment
- run:
# Run "exclusive" and "manual" bazel-in-bazel integration tests in their own CI job
# as they take 8m+ to execute and with bazel running inside bazel they are too
# memory intensive to be run in parallel with other tests so are tagged as "exclusive"
command: yarn bazel test //integration:bazel_test //integration:bazel-schematics_test
no_output_timeout: 20m
# Temporary job to test what will happen when we flip the Ivy flag to true
test_ivy_aot:
executor:
@ -842,9 +827,6 @@ workflows:
- test:
requires:
- setup
- test_integration_bazel:
requires:
- setup
- test_ivy_aot:
requires:
- setup

View File

@ -20,182 +20,44 @@ load(":angular_integration_test.bzl", "angular_integration_test")
# ng_elements 4205 /e2e/browser.config.json: "port": 4205
# platform-server 4206 /src/server.ts: app.listen(4206,...
# Map of integration tests to tags.
# A subset of these tests fail or are not meant to be run with ivy bundles. These are tagged
# "no-ivy-aot".
INTEGRATION_TESTS = {
"bazel": ["no-ivy-aot"],
"bazel-schematics": ["no-ivy-aot"],
"cli-hello-world": [],
"cli-hello-world-ivy-compat": [],
"cli-hello-world-ivy-i18n": ["no-ivy-aot"],
"cli-hello-world-ivy-minimal": [],
"cli-hello-world-lazy": [],
"cli-hello-world-lazy-rollup": [],
"dynamic-compiler": ["no-ivy-aot"],
"hello_world__closure": ["no-ivy-aot"],
"i18n": ["no-ivy-aot"],
"injectable-def": ["no-ivy-aot"],
"ivy-i18n": ["no-ivy-aot"],
"language_service_plugin": [],
"ng_elements": ["no-ivy-aot"],
# TODO: fix ng_elements_schematics with Bazel which was added recently and uses a new pattern
# "ng_elements_schematics": ["no-ivy-aot"],
"ng_update": [],
"ng_update_migrations": ["no-ivy-aot"],
"ngcc": ["no-ivy-aot"],
"platform-server": ["no-ivy-aot"],
"service-worker-schema": [],
"side-effects": ["no-ivy-aot"],
"terser": [],
}
[
angular_integration_test(
name = test_folder + "_test",
tags = INTEGRATION_TESTS[test_folder],
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",
for test_folder in INTEGRATION_TESTS
]
]
# 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",
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
@ -206,6 +68,15 @@ angular_integration_test(
test_folder = "typings_test_ts36",
)
# Special case for `typings_test_ts37` test as we want to pin
# `typescript` at version 3.7.x for that test and not link to the
# root @npm//typescript package.
angular_integration_test(
name = "typings_test_ts37_test",
pinned_npm_packages = ["typescript"],
test_folder = "typings_test_ts37",
)
# 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

View File

@ -14,7 +14,8 @@ readonly basedir=$(pwd)/..
# 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" \))
# TODO: remove ng_elements_schematics from this once it runs with npm_integration_test
readonly TEST_DIRS=$(find $(ls) -maxdepth 0 -type d \( -name "cli-hello-world*" -or -name "hello_world__closure" -or -name "ng_elements_schematics" \))
# 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

View File

@ -6,7 +6,7 @@
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts37/",
"outDir": "./dist/out-tsc",
"rootDir": ".",
"target": "es5",
"lib": [