Skip to content

Commit df808b8

Browse files
jelbournmmalerba
authored andcommitted
build: fix material unit tests not running (#7117)
1 parent 548eca0 commit df808b8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/package-tools/build-package.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {spawn} from 'child_process';
33
import {readFileSync, writeFileSync} from 'fs';
44
import {sync as glob} from 'glob';
55
import {join} from 'path';
6+
import {main as ngc} from '@angular/tsc-wrapped';
67
import {PackageBundler} from './build-bundles';
78
import {buildConfig} from './build-config';
89
import {getSecondaryEntryPointsForPackage} from './secondary-entry-points';
@@ -82,7 +83,7 @@ export class BuildPackage {
8283

8384
/** Compiles the TypeScript test source files for the package. */
8485
async compileTests() {
85-
await this._compileEntryPoint(testsTsconfigName);
86+
await this._compileTestEntryPoint(testsTsconfigName);
8687
}
8788

8889
/** Creates all bundles for the package and all associated entry points. */
@@ -108,6 +109,15 @@ export class BuildPackage {
108109
.then(() => this.renamePrivateReExportsToBeUnique(secondaryEntryPoint));
109110
}
110111

112+
/** Compiles the TypeScript sources of a primary or secondary entry point. */
113+
private async _compileTestEntryPoint(tsconfigName: string, secondaryEntryPoint = '') {
114+
const entryPointPath = join(this.sourceDir, secondaryEntryPoint);
115+
const entryPointTsconfigPath = join(entryPointPath, tsconfigName);
116+
117+
await ngc(entryPointTsconfigPath, {basePath: entryPointPath});
118+
this.renamePrivateReExportsToBeUnique(secondaryEntryPoint);
119+
}
120+
111121
/** Renames `ɵa`-style re-exports generated by Angular to be unique across compilation units. */
112122
private renamePrivateReExportsToBeUnique(secondaryEntryPoint = '') {
113123
// When we compiled the typescript sources with ngc, we do entry-point individually.

0 commit comments

Comments
 (0)