Skip to content

build: fix material unit tests not running #7117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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