fix(compiler): generate the correct imports for summary type-check

Summaries should be ignored when importing the types used in a
type-check block.
This commit is contained in:
Chuck Jazdzewski
2017-12-11 08:50:46 -08:00
committed by Alex Rickabaugh
parent d213a20dfc
commit d91ff17adc
5 changed files with 64 additions and 39 deletions

View File

@ -12,6 +12,7 @@ import * as path from 'path';
import * as ts from 'typescript';
import * as ng from '../index';
// TEST_TMPDIR is set by bazel.
const tmpdir = process.env.TEST_TMPDIR || os.tmpdir();
function getNgRootDir() {
@ -21,7 +22,6 @@ function getNgRootDir() {
}
export function writeTempFile(name: string, contents: string): string {
// TEST_TMPDIR is set by bazel.
const id = (Math.random() * 1000000).toFixed(0);
const fn = path.join(tmpdir, `tmp.${id}.${name}`);
fs.writeFileSync(fn, contents);
@ -29,8 +29,12 @@ export function writeTempFile(name: string, contents: string): string {
}
export function makeTempDir(): string {
const id = (Math.random() * 1000000).toFixed(0);
const dir = path.join(tmpdir, `tmp.${id}`);
let dir: string;
while (true) {
const id = (Math.random() * 1000000).toFixed(0);
dir = path.join(tmpdir, `tmp.${id}`);
if (!fs.existsSync(dir)) break;
}
fs.mkdirSync(dir);
return dir;
}