Files
reverse-engineering-anything/src/domain/referenceSourcePathIdentity.test.ts
T
c0d550b231 fix(reference): resolve runtime imports from their owning syntax
Distinguish call-form require from TypeScript import-equals before resolving
inventory paths. Probe CommonJS files before indexes and honor package main
without requiring an index. Retain selected manifest directory identities and
reuse the path lookup owner for canonical ambiguity.

Validated with source/reader tests and a public CLI fixture controlled by the
pinned Node loader. Windows no-follow reader behavior remains unverified.
Refs #3895, #3896, #3973, #4017.

Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
Co-authored-by: IssueHunter Worker <issuehunter@users.noreply.github.com>
2026-10-16 05:43:04 +08:00

16 lines
620 B
TypeScript

import { expect, it } from "vitest";
import { createReferenceSourcePathLookup } from "./referenceSourcePathIdentity.js";
it("reports ambiguous canonical identities while preserving exact paths", () => {
const first = "package/a\u0301\u0323/package.json";
const second = "package/a\u0323\u0301/package.json";
const third = "package/\u1ea1\u0301/package.json";
const lookup = createReferenceSourcePathLookup([first, second]);
expect(lookup.has(third)).toBe(true);
expect(lookup.resolve(third)).toBeUndefined();
expect(lookup.resolve(first)).toBe(first);
expect(lookup.resolve(second)).toBe(second);
});