test(zone.js): test zone.js package with tgz (#38649)
Zone.js 0.11.0 release an empty bundle, and now the npm_package tests all target bazel rule `npm_package`, but not `npm_package.pack`, and these two rules may generate different results, for example, Zone.js 0.11.0's issue is `package.json` define files array which make the bundle only include the files in the files array. So this PR install the zone.js package from the archive generated from `npm_package.pack` rule. PR Close #38649
This commit is contained in:

committed by
Andrew Kushnir

parent
ad372f2d20
commit
d37939623f
@ -9,7 +9,8 @@
|
||||
'use strict';
|
||||
|
||||
const {resolve} = require('path');
|
||||
const {chmod, cp, mkdir, rm, test} = require('shelljs');
|
||||
const {chmod, cp, mkdir, mv, rm, test} = require('shelljs');
|
||||
const zonePackageJson = require('../../packages/zone.js/package.json');
|
||||
const {baseDir, bazelBin, bazelCmd, exec, scriptPath} = require('./package-builder');
|
||||
|
||||
|
||||
@ -45,10 +46,22 @@ function buildZoneJsPackage(destPath) {
|
||||
const buildOutputDir = `${bazelBin}/packages/zone.js/npm_package`;
|
||||
const distTargetDir = `${absDestPath}/zone.js`;
|
||||
|
||||
console.info(`# Copy artifacts to ${distTargetDir}`);
|
||||
// Also create an archive so we can test the package itself.
|
||||
// Currently, the `npm_package.pack` rule does not work on Windows, so run `npm pack` directly.
|
||||
exec(`npm pack ${buildOutputDir}`);
|
||||
|
||||
console.info(`# Copy npm_package artifacts to ${distTargetDir}`);
|
||||
rm('-rf', distTargetDir);
|
||||
cp('-R', buildOutputDir, distTargetDir);
|
||||
chmod('-R', 'u+w', distTargetDir);
|
||||
|
||||
// Copy `zone.js.tgz` to `destPath`, so we can test
|
||||
// the archive generated by the `npm_package.pack` rule.
|
||||
const distArchiveTargetDir = `${absDestPath}/archive`;
|
||||
console.info(`# Copy npm_package archive file to ${distArchiveTargetDir}`);
|
||||
rm('-rf', distArchiveTargetDir);
|
||||
mkdir('-p', distArchiveTargetDir);
|
||||
mv(`${baseDir}/zone.js-${zonePackageJson.version}.tgz`, `${distArchiveTargetDir}/zone.js.tgz`);
|
||||
|
||||
console.info('');
|
||||
}
|
||||
|
Reference in New Issue
Block a user