Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,30 +614,28 @@ jobs:
//packages/common/locales

# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
mkdir -p dist/all/@angular/core/test/reflection/
mkdir -p dist/legacy-test-out/core/test/reflection/
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
dist/all/@angular/core/test/reflection/es5_downleveled_inheritance_fixture.js
dist/legacy-test-out/core/test/reflection/es5_downleveled_inheritance_fixture.js
# Locale files are needed for i18n tests running within Saucelabs. These are added
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
# can succeed. Note that the base locale and currencies files are checked-in, so
# we do not need to re-generate those through Bazel.
mkdir -p packages/common/locales/extra
cp dist/bin/packages/common/locales/*.ts packages/common/locales
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
# add module umd tsc compile option so the test can work
# properly in the legacy browsers
- run: yarn tsc -p packages/tsconfig-legacy-saucelabs.json --module UMD
- run: yarn tsc -p modules --module UMD
# Build ZoneJS so that it can be loaded globally in the Karma tests.
- run: yarn bazel build //packages/zone.js:npm_package
# Build the bundle for all tests to run within Saucelabs
- run: node tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
- run:
# Waiting on ready ensures that we don't run tests too early without Saucelabs not being ready.
name: Waiting for Saucelabs tunnel to connect
command: ./tools/saucelabs/sauce-service.sh ready-wait
- run:
name: Running tests on Saucelabs.
command: |
browsers=$(node -e 'console.log(require("./browser-providers.conf").sauceAliases.CI_REQUIRED.join(","))')
yarn karma start ./karma-js.conf.js --single-run --browsers=${browsers}
KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
- run:
name: Stop Saucelabs tunnel service
command: ./tools/saucelabs/sauce-service.sh stop
Expand Down
1 change: 1 addition & 0 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ groups:
'tools/circular_dependency_test/**',
'tools/contributing-stats/**',
'tools/gulp-tasks/**',
'tools/legacy-saucelabs/**',
'tools/npm/**',
'tools/npm_integration_test/**',
'tools/rxjs/**',
Expand Down
102 changes: 20 additions & 82 deletions browser-providers.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,98 +10,36 @@
// If the target is set to null, then the browser is not run anywhere during CI.
// If a category becomes empty (e.g. BS and required), then the corresponding job must be commented
// out in the CI configuration.
var CIconfiguration = {
// Chrome and Firefox run as part of the Bazel browser tests, so we do not run them as
// part of the legacy Saucelabs tests.
'Chrome': {unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
'Firefox': {unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
// Set ESR as a not required browser as it fails for Ivy acceptance tests.
'FirefoxESR': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
// Disabled because using the "beta" channel of Chrome can cause non-deterministic CI results.
// e.g. a new chrome beta version has been released, but the Saucelabs selenium server does
// not provide a chromedriver version that is compatible with the new beta.
'ChromeBeta': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: false}},
'ChromeDev': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
// FirefoxBeta and FirefoxDev should be target:'BS' or target:'SL', and required:true
// Currently deactivated due to https://github.com/angular/angular/issues/7560
'FirefoxBeta': {unitTest: {target: null, required: true}, e2e: {target: null, required: false}},
'FirefoxDev': {unitTest: {target: null, required: true}, e2e: {target: null, required: true}},
'Edge': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Android10': {unitTest: {target: 'SL', required: true}, e2e: {target: null, required: true}},
'Android11': {unitTest: {target: 'SL', required: true}, e2e: {target: null, required: true}},
'Safari12': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Safari13': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'iOS12': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'iOS13': {unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'WindowsPhone': {unitTest: {target: 'BS', required: false}, e2e: {target: null, required: true}}
const config = {
'Android10': {unitTest: {target: 'SL', required: true}},
'Android11': {unitTest: {target: 'SL', required: true}},
};

var customLaunchers = {
'DartiumWithWebPlatform':
{base: 'Dartium', flags: ['--enable-experimental-web-platform-features']},
'ChromeNoSandbox': {base: 'Chrome', flags: ['--no-sandbox']},
'SL_CHROME': {base: 'SauceLabs', browserName: 'chrome', version: '81'},
'SL_CHROMEBETA': {base: 'SauceLabs', browserName: 'chrome', version: 'beta'},
'SL_CHROMEDEV': {base: 'SauceLabs', browserName: 'chrome', version: 'dev'},
'SL_FIREFOX': {base: 'SauceLabs', browserName: 'firefox', version: '76'},
// Firefox 68 is the current ESR vesion
'SL_FIREFOXESR': {base: 'SauceLabs', browserName: 'firefox', version: '68'},
'SL_FIREFOXBETA':
{base: 'SauceLabs', platform: 'Windows 10', browserName: 'firefox', version: 'beta'},
'SL_FIREFOXDEV':
{base: 'SauceLabs', platform: 'Windows 10', browserName: 'firefox', version: 'dev'},
'SL_SAFARI12':
{base: 'SauceLabs', browserName: 'safari', platform: 'macOS 10.13', version: '12.1'},
'SL_SAFARI13':
{base: 'SauceLabs', browserName: 'safari', platform: 'macOS 10.15', version: '13.0'},
'SL_IOS12': {
base: 'SauceLabs',
browserName: 'Safari',
platform: 'iOS',
version: '12.0',
device: 'iPhone 7 Simulator'
},
'SL_IOS13': {
base: 'SauceLabs',
browserName: 'Safari',
platform: 'iOS',
version: '13.0',
device: 'iPhone 11 Simulator'
},
'SL_EDGE': {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: '14.14393'
},
/** Whether browsers should be remotely acquired in debug mode. */
const debugMode = false;

const customLaunchers = {
'SL_ANDROID10': {
base: 'SauceLabs',
browserName: 'Chrome',
platform: 'Android',
version: '10.0',
device: 'Android GoogleAPI Emulator'
platformName: 'Android',
platformVersion: '10.0',
deviceName: 'Google Pixel 3a GoogleAPI Emulator',
appiumVersion: '1.20.2',
extendedDebugging: debugMode,
},
'SL_ANDROID11': {
base: 'SauceLabs',
browserName: 'Chrome',
platform: 'Android',
version: '11.0',
device: 'Android GoogleAPI Emulator'
platformName: 'Android',
platformVersion: '11.0',
deviceName: 'Google Pixel 3a GoogleAPI Emulator',
appiumVersion: '1.20.2',
extendedDebugging: debugMode,
},
};

var sauceAliases = {
'ALL': Object.keys(customLaunchers).filter(function(item) {
return customLaunchers[item].base == 'SauceLabs';
}),
'DESKTOP': ['SL_CHROME', 'SL_FIREFOX', 'SL_EDGE', 'SL_SAFARI12', 'SL_SAFARI13', 'SL_FIREFOXESR'],
'MOBILE': ['SL_ANDROID10', 'SL_ANDROID11', 'SL_IOS12', 'SL_IOS13'],
'ANDROID': ['SL_ANDROID10', 'SL_ANDROID11'],
'FIREFOX': ['SL_FIREFOXESR'],
'IOS': ['SL_IOS12', 'SL_IOS13'],
'SAFARI': ['SL_SAFARI12', 'SL_SAFARI13'],
'BETA': ['SL_CHROMEBETA', 'SL_FIREFOXBETA'],
'DEV': ['SL_CHROMEDEV', 'SL_FIREFOXDEV'],
const sauceAliases = {
'CI_REQUIRED': buildConfiguration('unitTest', 'SL', true),
'CI_OPTIONAL': buildConfiguration('unitTest', 'SL', false)
};
Expand All @@ -112,9 +50,9 @@ module.exports = {
};

function buildConfiguration(type, target, required) {
return Object.keys(CIconfiguration)
return Object.keys(config)
.filter((item) => {
var conf = CIconfiguration[item][type];
const conf = config[item][type];
return conf.required === required && conf.target === target;
})
.map((item) => target + '_' + item.toUpperCase());
Expand Down
60 changes: 13 additions & 47 deletions karma-js.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const browserProvidersConf = require('./browser-providers.conf');
const {generateSeed} = require('./tools/jasmine-seed-generator');
const {hostname} = require('os');

// Karma configuration
// Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
module.exports = function(config) {
const conf = {
frameworks: ['jasmine'],
Expand All @@ -21,14 +19,10 @@ module.exports = function(config) {
random: true,
seed: generateSeed('karma-js.conf'),
},
captureConsole: process.env.CI ? false : true,
captureConsole: true,
},

files: [
// Sources and specs.
// Loaded through the System loader, in `test-main.js`.
{pattern: 'dist/all/@angular/**/*.js', included: false, watched: true},

// Serve AngularJS for `ngUpgrade` testing.
{pattern: 'node_modules/angular-1.5/angular?(.min).js', included: false, watched: false},
{pattern: 'node_modules/angular-mocks-1.5/angular-mocks.js', included: false, watched: false},
Expand All @@ -48,10 +42,9 @@ module.exports = function(config) {
'dist/bin/packages/zone.js/npm_package/bundles/zone-testing.umd.js',
'dist/bin/packages/zone.js/npm_package/bundles/task-tracking.umd.js',

// Including systemjs because it defines `__eval`, which produces correct stack traces.
'test-events.js',
'third_party/shims_for_internal_tests.js',
'node_modules/systemjs/dist/system.src.js',
// Static test assets.
{pattern: 'packages/platform-browser/test/static_assets/**/*', included: false},
{pattern: 'packages/platform-browser/test/browser/static_assets/**/*', included: false},

// Serve polyfills necessary for testing the `elements` package.
{
Expand All @@ -60,42 +53,9 @@ module.exports = function(config) {
watched: false
},

{pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true},
'node_modules/reflect-metadata/Reflect.js',
'tools/build/file2modulename.js',
'test-main.js',
{pattern: 'dist/all/@angular/empty.*', included: false, watched: false},
{pattern: 'packages/platform-browser/test/static_assets/**', included: false, watched: false},
{
pattern: 'packages/platform-browser/test/browser/static_assets/**',
included: false,
watched: false,
},
],

exclude: [
'dist/all/@angular/_testing_init/**',
'dist/all/@angular/**/e2e_test/**',
'dist/all/@angular/**/*node_only_spec.js',
'dist/all/@angular/benchpress/**',
'dist/all/@angular/compiler-cli/**',
'dist/all/@angular/compiler-cli/src/ngtsc/**',
'dist/all/@angular/compiler-cli/test/compliance/**',
'dist/all/@angular/compiler-cli/test/ngtsc/**',
'dist/all/@angular/compiler/test/aot/**',
'dist/all/@angular/compiler/test/render3/**',
'dist/all/@angular/core/test/bundling/**',
'dist/all/@angular/core/test/render3/ivy/**',
'dist/all/@angular/core/test/render3/jit/**',
'dist/all/@angular/core/test/render3/perf/**',
'dist/all/@angular/elements/schematics/**',
'dist/all/@angular/examples/**/e2e_test/*',
'dist/all/@angular/language-service/**',
'dist/all/@angular/localize/**/test/**',
'dist/all/@angular/localize/schematics/**',
'dist/all/@angular/router/**/test/**',
'dist/all/@angular/platform-browser/testing/e2e_util.js',
'dist/examples/**/e2e_test/**',
'dist/legacy-test-bundle.spec.js',
],

customLaunchers: browserProvidersConf.customLaunchers,
Expand Down Expand Up @@ -133,8 +93,8 @@ module.exports = function(config) {
maxDuration: 5400,
},

// Try "websocket" for a faster transmission first. Fallback to "polling" if necessary.
transports: ['websocket', 'polling'],
// Always use `polling` for increased communication stability.
transports: ['polling'],

port: 9876,
captureTimeout: 180000,
Expand All @@ -159,6 +119,12 @@ module.exports = function(config) {
// Setup the Saucelabs plugin so that it can launch browsers using the proper tunnel.
conf.sauceLabs.build = tunnelIdentifier;
conf.sauceLabs.tunnelIdentifier = tunnelIdentifier;

// Patch the `saucelabs` package so that `karma-sauce-launcher` does not attempt downloading
// the test logs from upstream and tries re-uploading them with the Karma enhanced details.
// This slows-down tests/browser restarting and can decrease stability.
// https://github.com/karma-runner/karma-sauce-launcher/blob/59b0c5c877448e064ad56449cd906743721c6b62/src/launcher/launcher.ts#L72-L79.
require('saucelabs').default.prototype.downloadJobAsset = () => Promise.resolve('<FAKE-LOGS>');
}

// For SauceLabs jobs, we set up a domain which resolves to the machine which launched
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmarks/src/old/compiler/compiler_benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {CompilerConfig, DirectiveResolver} from '@angular/compiler';
import {Component, ComponentResolver, Directive, ViewContainerRef,} from '@angular/core';
import {ViewMetadata} from '@angular/core/src/metadata/view';
import {ViewMetadata} from '@angular/core/view';
import {PromiseWrapper} from '@angular/facade/src/async';
import {print, Type} from '@angular/facade/src/lang';
import {bootstrap} from '@angular/platform-browser';
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
"inquirer": "^8.0.0",
"karma-sauce-launcher": "^4.3.6",
"madge": "^5.0.0",
"sauce-connect": "https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz",
"multimatch": "^6.0.0",
"sauce-connect": "https://saucelabs.com/downloads/sc-4.7.1-linux.tar.gz",
"semver": "^7.3.5",
"ts-node": "^10.0.0",
"tsec": "0.2.0",
Expand All @@ -192,6 +193,7 @@
"// 5": "Ensure a single version of webdriver-manager so it is hoisted as the integration tests depend on it being found at ../../node_modules/webdriver-manager",
"// 6": "Ensure that `@babel/*` packages match the below versions to avoid conflicts with `types/babel__*`",
"// 7": "Ensure that transitive dependencies on `https-proxy-agent` are at minimum v5 as older versions patch NodeJS directly, breaking tools like webdriver which is used by the karma-sauce-launcher as an example.",
"// 8": "Ensure that a single instance of the `saucelabs` package is used. Protractor and the Karma sauce launcher pull this package as dependency. A single instance allows for e.g. easier patching in the Karma config.",
"resolutions": {
"**/graceful-fs": "4.2.8",
"**/webdriver-manager": "12.1.8",
Expand All @@ -202,6 +204,7 @@
"@babel/template": "7.8.6",
"@babel/traverse": "7.8.6",
"@babel/types": "7.8.6",
"**/https-proxy-agent": "5.0.0"
"**/https-proxy-agent": "5.0.0",
"**/saucelabs": "4.7.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/

import ts from 'typescript';

import {Decorator, ReflectionHost} from '../../ngtsc/reflection';

import {isAliasImportDeclaration, loadIsReferencedAliasDeclarationPatch} from './patch_alias_reference_resolution';

/**
Expand Down Expand Up @@ -432,9 +434,9 @@ export function getDownlevelDecoratorsTransform(
ctor = ts.visitEachChild(ctor, decoratorDownlevelVisitor, context);

const newParameters: ts.ParameterDeclaration[] = [];
const oldParameters =
ts.visitParameterList(ctor.parameters, decoratorDownlevelVisitor, context);
const oldParameters = ctor.parameters;
const parametersInfo: ParameterDecorationInfo[] = [];

for (const param of oldParameters) {
const decoratorsToKeep: ts.Decorator[] = [];
const paramInfo: ParameterDecorationInfo = {decorators: [], type: null};
Expand Down Expand Up @@ -465,9 +467,8 @@ export function getDownlevelDecoratorsTransform(
param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
newParameters.push(newParam);
}
const updated = ts.updateConstructor(
ctor, ctor.decorators, ctor.modifiers, newParameters,
ts.visitFunctionBody(ctor.body, decoratorDownlevelVisitor, context));
const updated =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alxhub could you please help with the review of the compiler-related changes?

ts.updateConstructor(ctor, ctor.decorators, ctor.modifiers, newParameters, ctor.body);
return [updated, parametersInfo];
}

Expand Down
22 changes: 22 additions & 0 deletions packages/compiler-cli/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ jasmine_node_test(
],
)

ts_library(
name = "downlevel_decorator_transform_lib",
testonly = True,
srcs = [
"downlevel_decorators_transform_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler-cli/src/ngtsc/reflection",
"//packages/compiler-cli/src/transformers/downlevel_decorators_transform",
"@npm//typescript",
],
)

jasmine_node_test(
name = "downlevel_decorator_transform",
bootstrap = ["//tools/testing:node_es5"],
deps = [
":downlevel_decorator_transform_lib",
],
)

# perform_watch_spec
ts_library(
name = "perform_watch_lib",
Expand Down
Loading