Skip to content

Commit 27d2a2d

Browse files
committed
add test
1 parent 95494ef commit 27d2a2d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/testRunner/unittests/moduleResolution.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,21 @@ namespace ts {
194194
});
195195

196196
describe("Node module resolution - non-relative paths", () => {
197+
it("computes correct commonPrefix for moduleName cache", () => {
198+
const cache = createModuleResolutionCache("/", (f) => f).getOrCreateCacheForModuleName("a");
199+
cache.set("/sub", {
200+
resolvedModule: {
201+
originalPath: undefined,
202+
resolvedFileName: "/sub/node_modules/a/index.ts",
203+
isExternalLibraryImport: true,
204+
extension: Extension.Ts,
205+
},
206+
failedLookupLocations: [],
207+
});
208+
assert.isDefined(cache.get("/sub"));
209+
assert.isUndefined(cache.get("/"));
210+
});
211+
197212
it("load module as file - ts files not loaded", () => {
198213
test(/*hasDirectoryExists*/ false);
199214
test(/*hasDirectoryExists*/ true);

0 commit comments

Comments
 (0)