mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: fix material unit tests not running (#7117)
This commit is contained in:
@@ -3,6 +3,7 @@ import {spawn} from 'child_process';
|
||||
import {readFileSync, writeFileSync} from 'fs';
|
||||
import {sync as glob} from 'glob';
|
||||
import {join} from 'path';
|
||||
import {main as ngc} from '@angular/tsc-wrapped';
|
||||
import {PackageBundler} from './build-bundles';
|
||||
import {buildConfig} from './build-config';
|
||||
import {getSecondaryEntryPointsForPackage} from './secondary-entry-points';
|
||||
@@ -82,7 +83,7 @@ export class BuildPackage {
|
||||
|
||||
/** Compiles the TypeScript test source files for the package. */
|
||||
async compileTests() {
|
||||
await this._compileEntryPoint(testsTsconfigName);
|
||||
await this._compileTestEntryPoint(testsTsconfigName);
|
||||
}
|
||||
|
||||
/** Creates all bundles for the package and all associated entry points. */
|
||||
@@ -108,6 +109,15 @@ export class BuildPackage {
|
||||
.then(() => this.renamePrivateReExportsToBeUnique(secondaryEntryPoint));
|
||||
}
|
||||
|
||||
/** Compiles the TypeScript sources of a primary or secondary entry point. */
|
||||
private async _compileTestEntryPoint(tsconfigName: string, secondaryEntryPoint = '') {
|
||||
const entryPointPath = join(this.sourceDir, secondaryEntryPoint);
|
||||
const entryPointTsconfigPath = join(entryPointPath, tsconfigName);
|
||||
|
||||
await ngc(entryPointTsconfigPath, {basePath: entryPointPath});
|
||||
this.renamePrivateReExportsToBeUnique(secondaryEntryPoint);
|
||||
}
|
||||
|
||||
/** Renames `ɵa`-style re-exports generated by Angular to be unique across compilation units. */
|
||||
private renamePrivateReExportsToBeUnique(secondaryEntryPoint = '') {
|
||||
// When we compiled the typescript sources with ngc, we do entry-point individually.
|
||||
|
||||
Reference in New Issue
Block a user