build: fix material unit tests not running (#7117)

This commit is contained in:
Jeremy Elbourn
2017-09-15 15:28:38 -07:00
committed by mmalerba
parent 548eca0538
commit df808b845c
+11 -1
View File
@@ -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.