diff --git a/packages/compiler-cli/test/test_support.ts b/packages/compiler-cli/test/test_support.ts index b033097299..34ac6e6a92 100644 --- a/packages/compiler-cli/test/test_support.ts +++ b/packages/compiler-cli/test/test_support.ts @@ -122,8 +122,15 @@ export function setupBazelTo(tmpDirPath: string) { fs.mkdirSync(nodeModulesPath); fs.mkdirSync(angularDirectory); - getAngularPackagesFromRunfiles().forEach( - ({pkgPath, name}) => { fs.symlinkSync(pkgPath, path.join(angularDirectory, name), 'dir'); }); + getAngularPackagesFromRunfiles().forEach(({pkgPath, name}) => { + fs.symlinkSync(pkgPath, path.join(angularDirectory, name), 'dir'); + + // todo: check why we always need an index.d.ts + if (!fs.existsSync(path.join(angularDirectory, name, 'index.d.ts'))) { + fs.symlinkSync( + path.join(pkgPath, `${name}.d.ts`), path.join(angularDirectory, name, 'index.d.ts')); + } + }); // Link typescript const typeScriptSource = resolveNpmTreeArtifact('npm/node_modules/typescript'); diff --git a/packages/compiler/test/aot/test_util.ts b/packages/compiler/test/aot/test_util.ts index ce969725ef..bd1b416821 100644 --- a/packages/compiler/test/aot/test_util.ts +++ b/packages/compiler/test/aot/test_util.ts @@ -591,6 +591,11 @@ function readBazelWrittenFilesFrom( } try { processDirectory(bazelPackageRoot, path.join('/node_modules/@angular', packageName)); + // todo: check why we always need an index.d.ts + if (fs.existsSync(path.join(bazelPackageRoot, `${packageName}.d.ts`))) { + const content = fs.readFileSync(path.join(bazelPackageRoot, `${packageName}.d.ts`), 'utf8'); + map.set(path.join('/node_modules/@angular', packageName, 'index.d.ts'), content); + } } catch (e) { console.error( `Consider adding //packages/${packageName} as a data dependency in the BUILD.bazel rule for the failing test`);