Revert "build(docs-infra): use local version of Zone.js when testing against local packages (#35780)" (#35857)

This reverts commit 7d832ae1001b6264bb7124086089e9e69c10c9b6; breaks CI
with error `Concurrent upstream jobs persisted the same file(s) into the workspace:`

PR Close #35857
This commit is contained in:
Andrew Scott 2020-03-04 10:18:42 -08:00
parent 25ab4647c5
commit 1b8a66893e
4 changed files with 69 additions and 119 deletions

View File

@ -552,7 +552,6 @@ jobs:
root: *workspace_location root: *workspace_location
paths: paths:
- ng/dist/packages-dist-ivy-aot - ng/dist/packages-dist-ivy-aot
- ng/dist/zone.js-dist
# We run a subset of the integration tests outside of Bazel that track # We run a subset of the integration tests outside of Bazel that track
# payload size. # payload size.

View File

@ -14,12 +14,11 @@ const LOCAL_MARKER_PATH = 'node_modules/_local_.json';
const ANGULAR_ROOT_DIR = path.resolve(__dirname, '../../..'); const ANGULAR_ROOT_DIR = path.resolve(__dirname, '../../..');
const ANGULAR_DIST_PACKAGES_DIR = path.join(ANGULAR_ROOT_DIR, 'dist/packages-dist'); const ANGULAR_DIST_PACKAGES_DIR = path.join(ANGULAR_ROOT_DIR, 'dist/packages-dist');
const ZONEJS_DIST_PACKAGES_DIR = path.join(ANGULAR_ROOT_DIR, 'dist/zone.js-dist');
const DIST_PACKAGES_BUILD_SCRIPT = path.join(ANGULAR_ROOT_DIR, 'scripts/build/build-packages-dist.js'); const DIST_PACKAGES_BUILD_SCRIPT = path.join(ANGULAR_ROOT_DIR, 'scripts/build/build-packages-dist.js');
const DIST_PACKAGES_BUILD_CMD = `"${process.execPath}" "${DIST_PACKAGES_BUILD_SCRIPT}"`; const DIST_PACKAGES_BUILD_CMD = `"${process.execPath}" "${DIST_PACKAGES_BUILD_SCRIPT}"`;
/** /**
* A tool that can install Angular/Zone.js dependencies for a project from NPM or from the * A tool that can install Angular dependencies for a project from NPM or from the
* locally built distributables. * locally built distributables.
* *
* This tool is used to change dependencies of the `aio` application and the example * This tool is used to change dependencies of the `aio` application and the example
@ -34,7 +33,7 @@ class NgPackagesInstaller {
* @param {object} options - a hash of options for the install: * @param {object} options - a hash of options for the install:
* * `debug` (`boolean`) - whether to display debug messages. * * `debug` (`boolean`) - whether to display debug messages.
* * `force` (`boolean`) - whether to force a local installation even if there is a local marker file. * * `force` (`boolean`) - whether to force a local installation even if there is a local marker file.
* * `buildPackages` (`boolean`) - whether to build the local Angular/Zone.js packages before using them. * * `buildPackages` (`boolean`) - whether to build the local Angular packages before using them.
* (NOTE: Building the packages is currently not supported on Windows, so a message is printed instead.) * (NOTE: Building the packages is currently not supported on Windows, so a message is printed instead.)
* * `ignorePackages` (`string[]`) - a collection of names of packages that should not be copied over. * * `ignorePackages` (`string[]`) - a collection of names of packages that should not be copied over.
*/ */
@ -53,7 +52,7 @@ class NgPackagesInstaller {
/** /**
* Check whether the dependencies have been overridden with locally built * Check whether the dependencies have been overridden with locally built
* Angular/Zone.js packages. This is done by checking for the `_local_.json` marker file. * Angular packages. This is done by checking for the `_local_.json` marker file.
* This will emit a warning to the console if the dependencies have been overridden. * This will emit a warning to the console if the dependencies have been overridden.
*/ */
checkDependencies() { checkDependencies() {
@ -63,8 +62,8 @@ class NgPackagesInstaller {
} }
/** /**
* Install locally built Angular/Zone.js dependencies, overriding the dependencies in the `package.json`. * Install locally built Angular dependencies, overriding the dependencies in the package.json
* This will also write a "marker" file (`_local_.json`), which contains the overridden `package.json` * This will also write a "marker" file (`_local_.json`), which contains the overridden package.json
* contents and acts as an indicator that dependencies have been overridden. * contents and acts as an indicator that dependencies have been overridden.
*/ */
installLocalDependencies() { installLocalDependencies() {
@ -87,13 +86,13 @@ class NgPackagesInstaller {
// Prevent accidental publishing of the package, if something goes wrong. // Prevent accidental publishing of the package, if something goes wrong.
tmpConfig.private = true; tmpConfig.private = true;
// Overwrite project dependencies/devDependencies to Angular/Zone.js packages with local files. // Overwrite project dependencies/devDependencies to Angular packages with local files.
['dependencies', 'devDependencies'].forEach(prop => { ['dependencies', 'devDependencies'].forEach(prop => {
const deps = tmpConfig[prop] || {}; const deps = tmpConfig[prop] || {};
Object.keys(deps).forEach(key2 => { Object.keys(deps).forEach(key2 => {
const pkg2 = packages[key2]; const pkg2 = packages[key2];
if (pkg2) { if (pkg2) {
// point the local packages at the distributable folder // point the core Angular packages at the distributable folder
deps[key2] = `file:${pkg2.packageDir}`; deps[key2] = `file:${pkg2.packageDir}`;
this._log(`Overriding dependency of local ${key} with local package: ${key2}: ${deps[key2]}`); this._log(`Overriding dependency of local ${key} with local package: ${key2}: ${deps[key2]}`);
} }
@ -126,8 +125,8 @@ class NgPackagesInstaller {
fs.writeFileSync(pathToPackageConfig, packageConfigFile); fs.writeFileSync(pathToPackageConfig, packageConfigFile);
} }
} finally { } finally {
// Restore local Angular/Zone.js packages dependencies to other Angular packages. // Restore local Angular packages dependencies to other Angular packages.
this._log(`Restoring original ${PACKAGE_JSON} for local packages.`); this._log(`Restoring original ${PACKAGE_JSON} for local Angular packages.`);
Object.keys(packages).forEach(key => { Object.keys(packages).forEach(key => {
const pkg = packages[key]; const pkg = packages[key];
fs.writeFileSync(pkg.packageJsonPath, JSON.stringify(pkg.config, null, 2)); fs.writeFileSync(pkg.packageJsonPath, JSON.stringify(pkg.config, null, 2));
@ -168,7 +167,7 @@ class NgPackagesInstaller {
} }
/** /**
* Build the local Angular/Zone.js packages. * Build the local Angular packages.
* *
* NOTE: * NOTE:
* Building the packages is currently not supported on Windows, so a message is printed instead, prompting the user to * Building the packages is currently not supported on Windows, so a message is printed instead, prompting the user to
@ -178,14 +177,14 @@ class NgPackagesInstaller {
const canBuild = process.platform !== 'win32'; const canBuild = process.platform !== 'win32';
if (canBuild) { if (canBuild) {
this._log(`Building the local packages with: ${DIST_PACKAGES_BUILD_SCRIPT}`); this._log(`Building the Angular packages with: ${DIST_PACKAGES_BUILD_SCRIPT}`);
shelljs.exec(DIST_PACKAGES_BUILD_CMD); shelljs.exec(DIST_PACKAGES_BUILD_CMD);
} else { } else {
this._warn([ this._warn([
'Automatically building the local Angular/Zone.js packages is currently not supported on Windows.', 'Automatically building the local Angular packages is currently not supported on Windows.',
`Please, ensure '${ANGULAR_DIST_PACKAGES_DIR}' and '${ZONEJS_DIST_PACKAGES_DIR}' exist and are up-to-date ` + `Please, ensure '${ANGULAR_DIST_PACKAGES_DIR}' exists and is up-to-date (e.g. by running ` +
`(e.g. by running '${DIST_PACKAGES_BUILD_SCRIPT}' in Git Bash for Windows, Windows Subsystem for Linux or ` + `'${DIST_PACKAGES_BUILD_SCRIPT}' in Git Bash for Windows, Windows Subsystem for Linux or a Linux docker ` +
'a Linux docker container or VM).', 'container or VM).',
'', '',
'Proceeding anyway...', 'Proceeding anyway...',
].join('\n')); ].join('\n'));
@ -205,7 +204,7 @@ class NgPackagesInstaller {
// grab peer dependencies // grab peer dependencies
const sourcePackagePeerDeps = sourcePackage.config.peerDependencies || {}; const sourcePackagePeerDeps = sourcePackage.config.peerDependencies || {};
Object.keys(sourcePackagePeerDeps) Object.keys(sourcePackagePeerDeps)
// ignore peerDependencies which are already core Angular/Zone.js packages // ignore peerDependencies which are already core Angular packages
.filter(key => !packages[key]) .filter(key => !packages[key])
.forEach(key => peerDependencies[key] = sourcePackagePeerDeps[key]); .forEach(key => peerDependencies[key] = sourcePackagePeerDeps[key]);
} }
@ -215,13 +214,11 @@ class NgPackagesInstaller {
} }
/** /**
* A hash of Angular/Zone.js package configs. * A hash of Angular package configs.
* (Detected as directories in '/dist/packages-dist/' and '/dist/zone.js-dist/' that contain a top-level * (Detected as directories in '/dist/packages-dist/' that contain a top-level 'package.json' file.)
* 'package.json' file.)
*/ */
_getDistPackages() { _getDistPackages() {
this._log(`Angular distributable directory: ${ANGULAR_DIST_PACKAGES_DIR}.`); this._log(`Angular distributable directory: ${ANGULAR_DIST_PACKAGES_DIR}.`);
this._log(`Zone.js distributable directory: ${ZONEJS_DIST_PACKAGES_DIR}.`);
if (this.buildPackages) { if (this.buildPackages) {
this._buildDistPackages(); this._buildDistPackages();
@ -257,10 +254,7 @@ class NgPackagesInstaller {
return packages; return packages;
}; };
const packageConfigs = { const packageConfigs = collectPackages(ANGULAR_DIST_PACKAGES_DIR);
...collectPackages(ANGULAR_DIST_PACKAGES_DIR),
...collectPackages(ZONEJS_DIST_PACKAGES_DIR),
};
this._log('Found the following Angular distributables:', Object.keys(packageConfigs).map(key => `\n - ${key}`)); this._log('Found the following Angular distributables:', Object.keys(packageConfigs).map(key => `\n - ${key}`));
return packageConfigs; return packageConfigs;
@ -349,7 +343,7 @@ class NgPackagesInstaller {
// Log a warning. // Log a warning.
this._warn([ this._warn([
`The project at "${absoluteProjectDir}" is running against the local Angular/Zone.js build.`, `The project at "${absoluteProjectDir}" is running against the local Angular build.`,
'', '',
'To restore the npm packages run:', 'To restore the npm packages run:',
'', '',
@ -402,10 +396,10 @@ function main() {
.option('debug', { describe: 'Print additional debug information.', default: false }) .option('debug', { describe: 'Print additional debug information.', default: false })
.option('force', { describe: 'Force the command to execute even if not needed.', default: false }) .option('force', { describe: 'Force the command to execute even if not needed.', default: false })
.option('build-packages', { describe: 'Build the local Angular/Zone.js packages, before using them.', default: false }) .option('build-packages', { describe: 'Build the local Angular packages, before using them.', default: false })
.option('ignore-packages', { describe: 'List of Angular/Zone.js packages that should not be used in local mode.', default: [], array: true }) .option('ignore-packages', { describe: 'List of Angular packages that should not be used in local mode.', default: [], array: true })
.command('overwrite <projectDir> [--force] [--debug] [--ignore-packages package1 package2]', 'Install dependencies from the locally built Angular/Zone.js distributables.', () => {}, argv => { .command('overwrite <projectDir> [--force] [--debug] [--ignore-packages package1 package2]', 'Install dependencies from the locally built Angular distributables.', () => {}, argv => {
createInstaller(argv).installLocalDependencies(); createInstaller(argv).installLocalDependencies();
}) })
.command('restore <projectDir> [--debug]', 'Install dependencies from the npm registry.', () => {}, argv => { .command('restore <projectDir> [--debug]', 'Install dependencies from the npm registry.', () => {}, argv => {

View File

@ -15,7 +15,6 @@ describe('NgPackagesInstaller', () => {
const yarnLockPath = path.resolve(absoluteProjectDir, 'yarn.lock'); const yarnLockPath = path.resolve(absoluteProjectDir, 'yarn.lock');
const ngRootDir = path.resolve(__dirname, '../../..'); const ngRootDir = path.resolve(__dirname, '../../..');
const packagesDir = path.join(ngRootDir, 'dist/packages-dist'); const packagesDir = path.join(ngRootDir, 'dist/packages-dist');
const zoneJsDir = path.join(ngRootDir, 'dist/zone.js-dist');
const toolsDir = path.join(ngRootDir, 'dist/tools/@angular'); const toolsDir = path.join(ngRootDir, 'dist/tools/@angular');
let installer; let installer;
@ -52,7 +51,7 @@ describe('NgPackagesInstaller', () => {
describe('installLocalDependencies()', () => { describe('installLocalDependencies()', () => {
const copyJsonObj = obj => JSON.parse(JSON.stringify(obj)); const copyJsonObj = obj => JSON.parse(JSON.stringify(obj));
let dummyLocalPackages, dummyPackage, dummyPackageJson, expectedModifiedPackage, expectedModifiedPackageJson; let dummyNgPackages, dummyPackage, dummyPackageJson, expectedModifiedPackage, expectedModifiedPackageJson;
beforeEach(() => { beforeEach(() => {
spyOn(installer, '_checkLocalMarker'); spyOn(installer, '_checkLocalMarker');
@ -61,18 +60,17 @@ describe('NgPackagesInstaller', () => {
spyOn(installer, '_parseLockfile').and.returnValue({ spyOn(installer, '_parseLockfile').and.returnValue({
'rxjs@^6.3.0': {version: '6.3.3'}, 'rxjs@^6.3.0': {version: '6.3.3'},
'rxjs-dev@^6.3.0': {version: '6.4.2'} 'zone.js@^0.8.26': {version: '0.8.27'}
}); });
// These are the packages that are "found" in the dist directory // These are the packages that are "found" in the dist directory
dummyLocalPackages = { dummyNgPackages = {
'@angular/core': { '@angular/core': {
packageDir: `${packagesDir}/core`, packageDir: `${packagesDir}/core`,
packageJsonPath: `${packagesDir}/core/package.json`, packageJsonPath: `${packagesDir}/core/package.json`,
config: { config: {
peerDependencies: { peerDependencies: {
'rxjs': '^6.4.0', 'rxjs': '^6.4.0',
'rxjs-dev': '^6.4.0',
'some-package': '5.0.1', 'some-package': '5.0.1',
'zone.js': '~0.8.26' 'zone.js': '~0.8.26'
} }
@ -103,40 +101,32 @@ describe('NgPackagesInstaller', () => {
devDependencies: { '@angular/common': '4.4.4-1ab23cd4' }, devDependencies: { '@angular/common': '4.4.4-1ab23cd4' },
peerDependencies: { tsickle: '^1.4.0' } peerDependencies: { tsickle: '^1.4.0' }
} }
}, }
'zone.js': {
packageDir: `${zoneJsDir}/zone.js`,
packageJsonPath: `${zoneJsDir}/zone.js/package.json`,
config: {
devDependencies: { typescript: '^2.4.2' }
}
},
}; };
spyOn(installer, '_getDistPackages').and.callFake(() => copyJsonObj(dummyLocalPackages)); spyOn(installer, '_getDistPackages').and.callFake(() => copyJsonObj(dummyNgPackages));
// This is the package.json in the "test" folder // This is the package.json in the "test" folder
dummyPackage = { dummyPackage = {
dependencies: { dependencies: {
'@angular/core': '4.4.1', '@angular/core': '4.4.1',
'@angular/common': '4.4.1', '@angular/common': '4.4.1',
rxjs: '^6.3.0', rxjs: '^6.3.0'
'zone.js': '^0.8.26'
}, },
devDependencies: { devDependencies: {
'@angular/compiler-cli': '4.4.1', '@angular/compiler-cli': '4.4.1',
'rxjs-dev': '^6.3.0' 'zone.js': '^0.8.26'
} }
}; };
dummyPackageJson = JSON.stringify(dummyPackage); dummyPackageJson = JSON.stringify(dummyPackage);
fs.readFileSync.and.returnValue(dummyPackageJson); fs.readFileSync.and.returnValue(dummyPackageJson);
// This is the package.json that is temporarily written to the "test" folder // This is the package.json that is temporarily written to the "test" folder
// Note that the Angular/Zone.js (dev)dependencies have been modified to use a "file:" path // Note that the Angular (dev)dependencies have been modified to use a "file:" path
// and that the peerDependencies from `dummyLocalPackages` have been updated or added as // And that the peerDependencies from `dummyNgPackages` have been updated or added as
// (dev)dependencies (unless the current version in lockfile satisfies semver). // (dev)dependencies (unless the current version in lockfile satisfies semver).
// //
// For example, `rxjs-dev@6.4.2` (from lockfile) satisfies `rxjs-dev@^6.4.0` (from // For example, `zone.js@0.8.27` (from lockfile) satisfies `zone.js@~0.8.26` (from
// `@angular/core`), thus `rxjs-dev: ^6.3.0` (from original `package.json`) is retained. // `@angular/core`), thus `zone.js: ^0.8.26` (from original `package.json`) is retained.
// In contrast, `rxjs@6.3.3` (from lockfile) does not satisfy `rxjs@^6.4.0 (from // In contrast, `rxjs@6.3.3` (from lockfile) does not satisfy `rxjs@^6.4.0 (from
// `@angular/core`), thus `rxjs: ^6.3.0` (from original `package.json`) is replaced with // `@angular/core`), thus `rxjs: ^6.3.0` (from original `package.json`) is replaced with
// `rxjs: ^6.4.0` (from `@angular/core`). // `rxjs: ^6.4.0` (from `@angular/core`).
@ -144,12 +134,11 @@ describe('NgPackagesInstaller', () => {
dependencies: { dependencies: {
'@angular/core': `file:${packagesDir}/core`, '@angular/core': `file:${packagesDir}/core`,
'@angular/common': `file:${packagesDir}/common`, '@angular/common': `file:${packagesDir}/common`,
'rxjs': '^6.4.0', 'rxjs': '^6.4.0'
'zone.js': `file:${zoneJsDir}/zone.js`,
}, },
devDependencies: { devDependencies: {
'@angular/compiler-cli': `file:${toolsDir}/compiler-cli`, '@angular/compiler-cli': `file:${toolsDir}/compiler-cli`,
'rxjs-dev': '^6.3.0', 'zone.js': '^0.8.26',
'some-package': '5.0.1', 'some-package': '5.0.1',
typescript: '^2.4.2' typescript: '^2.4.2'
}, },
@ -193,56 +182,31 @@ describe('NgPackagesInstaller', () => {
}); });
it('should temporarily overwrite the package.json files of local Angular packages', () => { it('should temporarily overwrite the package.json files of local Angular packages', () => {
const pkgJsonPathFor = pkgName => dummyLocalPackages[pkgName].packageJsonPath; const pkgJsonFor = pkgName => dummyNgPackages[`@angular/${pkgName}`].packageJsonPath;
const pkgConfigFor = pkgName => copyJsonObj(dummyLocalPackages[pkgName].config); const pkgConfigFor = pkgName => copyJsonObj(dummyNgPackages[`@angular/${pkgName}`].config);
const overwriteConfigFor = (pkgName, newProps) => Object.assign(pkgConfigFor(pkgName), newProps); const overwriteConfigFor = (pkgName, newProps) => Object.assign(pkgConfigFor(pkgName), newProps);
const stringifyConfig = config => JSON.stringify(config, null, 2); const stringifyConfig = config => JSON.stringify(config, null, 2);
const allArgs = fs.writeFileSync.calls.allArgs(); const allArgs = fs.writeFileSync.calls.allArgs();
const firstSixArgs = allArgs.slice(0, 6); const firstFiveArgs = allArgs.slice(0, 5);
const lastSixArgs = allArgs.slice(-6); const lastFiveArgs = allArgs.slice(-5);
expect(firstSixArgs).toEqual([ expect(firstFiveArgs).toEqual([
[ [pkgJsonFor('core'), stringifyConfig(overwriteConfigFor('core', {private: true}))],
pkgJsonPathFor('@angular/core'), [pkgJsonFor('common'), stringifyConfig(overwriteConfigFor('common', {private: true}))],
stringifyConfig(overwriteConfigFor('@angular/core', {private: true})), [pkgJsonFor('compiler'), stringifyConfig(overwriteConfigFor('compiler', {private: true}))],
], [pkgJsonFor('compiler-cli'), stringifyConfig(overwriteConfigFor('compiler-cli', {
[ private: true,
pkgJsonPathFor('@angular/common'), dependencies: { '@angular/tsc-wrapped': `file:${toolsDir}/tsc-wrapped` }
stringifyConfig(overwriteConfigFor('@angular/common', {private: true})), }))],
], [pkgJsonFor('tsc-wrapped'), stringifyConfig(overwriteConfigFor('tsc-wrapped', {
[ private: true,
pkgJsonPathFor('@angular/compiler'), devDependencies: { '@angular/common': `file:${packagesDir}/common` }
stringifyConfig(overwriteConfigFor('@angular/compiler', {private: true})), }))],
],
[
pkgJsonPathFor('@angular/compiler-cli'),
stringifyConfig(overwriteConfigFor('@angular/compiler-cli', {
private: true,
dependencies: { '@angular/tsc-wrapped': `file:${toolsDir}/tsc-wrapped` },
})),
],
[
pkgJsonPathFor('@angular/tsc-wrapped'),
stringifyConfig(overwriteConfigFor('@angular/tsc-wrapped', {
private: true,
devDependencies: { '@angular/common': `file:${packagesDir}/common` },
})),
],
[
pkgJsonPathFor('zone.js'),
stringifyConfig(overwriteConfigFor('zone.js', {private: true})),
],
]); ]);
expect(lastSixArgs).toEqual([ expect(lastFiveArgs).toEqual(['core', 'common', 'compiler', 'compiler-cli', 'tsc-wrapped']
'@angular/core', .map(pkgName => [pkgJsonFor(pkgName), stringifyConfig(pkgConfigFor(pkgName))]));
'@angular/common',
'@angular/compiler',
'@angular/compiler-cli',
'@angular/tsc-wrapped',
'zone.js',
].map(pkgName => [pkgJsonPathFor(pkgName), stringifyConfig(pkgConfigFor(pkgName))]));
}); });
it('should load the package.json', () => { it('should load the package.json', () => {
@ -316,7 +280,7 @@ describe('NgPackagesInstaller', () => {
expect(shelljs.exec).not.toHaveBeenCalled(); expect(shelljs.exec).not.toHaveBeenCalled();
expect(warning).toContain( expect(warning).toContain(
'Automatically building the local Angular/Zone.js packages is currently not supported on Windows.'); 'Automatically building the local Angular packages is currently not supported on Windows.');
expect(warning).toContain('Git Bash for Windows'); expect(warning).toContain('Git Bash for Windows');
expect(warning).toContain('Windows Subsystem for Linux'); expect(warning).toContain('Windows Subsystem for Linux');
expect(warning).toContain('Linux docker container or VM'); expect(warning).toContain('Linux docker container or VM');
@ -345,8 +309,8 @@ describe('NgPackagesInstaller', () => {
expect(installer._buildDistPackages).not.toHaveBeenCalled(); expect(installer._buildDistPackages).not.toHaveBeenCalled();
}); });
it('should include top level Angular and Zone.js packages', () => { it('should include top level Angular packages', () => {
const localPackages = installer._getDistPackages(); const ngPackages = installer._getDistPackages();
const expectedValue = jasmine.objectContaining({ const expectedValue = jasmine.objectContaining({
packageDir: jasmine.any(String), packageDir: jasmine.any(String),
packageJsonPath: jasmine.any(String), packageJsonPath: jasmine.any(String),
@ -354,30 +318,28 @@ describe('NgPackagesInstaller', () => {
}); });
// For example... // For example...
expect(localPackages['@angular/common']).toEqual(expectedValue); expect(ngPackages['@angular/common']).toEqual(expectedValue);
expect(localPackages['@angular/core']).toEqual(expectedValue); expect(ngPackages['@angular/core']).toEqual(expectedValue);
expect(localPackages['@angular/router']).toEqual(expectedValue); expect(ngPackages['@angular/router']).toEqual(expectedValue);
expect(localPackages['@angular/upgrade']).toEqual(expectedValue); expect(ngPackages['@angular/upgrade']).toEqual(expectedValue);
expect(localPackages['zone.js']).toEqual(expectedValue);
expect(localPackages['@angular/upgrade/static']).not.toBeDefined(); expect(ngPackages['@angular/upgrade/static']).not.toBeDefined();
}); });
it('should store each package\'s directory', () => { it('should store each package\'s directory', () => {
const localPackages = installer._getDistPackages(); const ngPackages = installer._getDistPackages();
// For example... // For example...
expect(localPackages['@angular/core'].packageDir).toBe(path.join(packagesDir, 'core')); expect(ngPackages['@angular/core'].packageDir).toBe(path.join(packagesDir, 'core'));
expect(localPackages['@angular/router'].packageDir).toBe(path.join(packagesDir, 'router')); expect(ngPackages['@angular/router'].packageDir).toBe(path.join(packagesDir, 'router'));
expect(localPackages['zone.js'].packageDir).toBe(path.join(zoneJsDir, 'zone.js'));
}); });
it('should not include packages that have been ignored', () => { it('should not include packages that have been ignored', () => {
installer = new NgPackagesInstaller(projectDir, { ignorePackages: ['@angular/router'] }); installer = new NgPackagesInstaller(projectDir, { ignorePackages: ['@angular/router'] });
const localPackages = installer._getDistPackages(); const ngPackages = installer._getDistPackages();
expect(localPackages['@angular/common']).toBeDefined(); expect(ngPackages['@angular/common']).toBeDefined();
expect(localPackages['@angular/router']).toBeUndefined(); expect(ngPackages['@angular/router']).toBeUndefined();
}); });
}); });
@ -518,7 +480,7 @@ describe('NgPackagesInstaller', () => {
describe('_printWarning()', () => { describe('_printWarning()', () => {
it('should mention the message passed in the warning', () => { it('should mention the message passed in the warning', () => {
installer._printWarning(); installer._printWarning();
expect(console.warn.calls.argsFor(0)[0]).toContain('is running against the local Angular/Zone.js build'); expect(console.warn.calls.argsFor(0)[0]).toContain('is running against the local Angular build');
}); });
it('should mention the command to restore the Angular packages in any warning', () => { it('should mention the command to restore the Angular packages in any warning', () => {

View File

@ -9,13 +9,8 @@
'use strict'; 'use strict';
const {buildZoneJsPackage} = require('./zone-js-builder');
const {buildTargetPackages} = require('./package-builder'); const {buildTargetPackages} = require('./package-builder');
// Build the ivy packages into `dist/packages-dist-ivy-aot/`. // Build the ivy packages into `dist/packages-dist-ivy-aot/`.
buildTargetPackages('dist/packages-dist-ivy-aot', true, 'Ivy AOT'); buildTargetPackages('dist/packages-dist-ivy-aot', true, 'Ivy AOT');
// Build the `zone.js` npm package into `dist/zone.js-dist/`, because it might be needed by other
// scripts/tests.
buildZoneJsPackage();