Skip to content

Commit

Permalink
build: fix material unit tests not running (#7117)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn authored and mmalerba committed Sep 15, 2017
1 parent 548eca0 commit df808b8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/package-tools/build-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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. */
Expand All @@ -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.
Expand Down

0 comments on commit df808b8

Please sign in to comment.