Update test that import code fix doesn't use node_modules global import if classic resolution is set (#20453)

This commit is contained in:
Andy 2017-12-04 13:15:45 -08:00 committed by GitHub
parent 272266f0e1
commit 93551ab93b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -2522,9 +2522,9 @@ Actual: ${stringify(fullActual)}`);
}
public verifyImportFixAtPosition(expectedTextArray: string[], errorCode?: number) {
const ranges = this.getRanges();
if (ranges.length === 0) {
this.raiseError("At least one range should be specified in the testfile.");
const ranges = this.getRanges().filter(r => r.fileName === this.activeFile.fileName);
if (ranges.length !== 1) {
this.raiseError("Exactly one range should be specified in the testfile.");
}
const codeFixes = this.getCodeFixActions(this.activeFile.fileName, errorCode);

View file

@ -12,11 +12,12 @@
////[|foo;|]
// @Filename: /c.ts
////bar;
////[|bar;|]
goTo.file("/a/index.ts");
goTo.file("/b.ts");
// Explicitly imports from "./a/index" and not just from "./a"
verify.importFixAtPosition([
`import { foo } from "./a/index";
@ -24,4 +25,8 @@ foo;`
]);
goTo.file("/c.ts");
// TODO: GH#20050 verify.not.codeFixAvailable();
// Does not use a global import for node_modules
verify.importFixAtPosition([
`import { bar } from "./node_modules/x/index";
bar;`]);