Allow 'paths' without 'baseUrl' (#40101)

* Allow paths without baseUrl

* Remove exception for leading * paths

* Add comment, remove commented code

* Update baselines

* Remove unnecessary default

* Fix test harness

* Fix baseline

* Resolve relative to host.getCurrentDirectory() with createProgram API
This commit is contained in:
Andrew Branch
2020-09-11 12:58:40 -07:00
committed by GitHub
parent aa2756a5d7
commit 9c8d11b5ed
26 changed files with 295 additions and 22 deletions

View File

@@ -204,4 +204,20 @@ namespace ts {
assert.isEmpty(program.getSemanticDiagnostics());
});
});
describe("unittests:: programApi:: CompilerOptions relative paths", () => {
it("resolves relative paths by getCurrentDirectory", () => {
const main = new documents.TextDocument("/main.ts", "import \"module\";");
const mod = new documents.TextDocument("/lib/module.ts", "declare const foo: any;");
const fs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { documents: [main, mod], cwd: "/" });
const program = createProgram(["./main.ts"], {
paths: { "*": ["./lib/*"] }
}, new fakes.CompilerHost(fs, { newLine: NewLineKind.LineFeed }));
assert.isEmpty(program.getConfigFileParsingDiagnostics());
assert.isEmpty(program.getGlobalDiagnostics());
assert.isEmpty(program.getSemanticDiagnostics());
});
});
}