dominikg / tsconfck

A utility to find and parse tsconfig files without depending on typescript
Other
293 stars 14 forks source link

Fix normalizeSnapshot when repository path contains special characters #178

Closed lPernod-sorare closed 4 months ago

dominikg commented 4 months ago

Hi, thank you for sending PRs. It would be great if you could give examples of what exactly this fixes.

lPernod-sorare commented 4 months ago

When cloning the repository into a folder that contained a . (/Users/loic.pernod/git-workspace) the tests did not pass on main with the following diffs: I've only added one failure here for brevity

-               "baseUrl": "<fixture-dir>/parse/valid/with_extends/paths",
+               "baseUrl": "/Users/loic.pernod/git-workspace/tsconfck/packages/tsconfck/tests/fixtures/parse/valid/with_extends/paths",

Investigating more, I found that the fixtureDirRegex was incorrect:

{
  fixtures: '/Users/loic.pernod/git-workspace/tsconfck/packages/tsconfck/tests/fixtures',
  fixtureDirRegex: /[/\\]Users[/\\]loic[/\\].pernod[/\\]git-workspace[/\\]tsconfck[/\\]packages[/\\]tsconfck[/\\]tests[/\\]fixtures/g
}

The second replace was matching the \ in \. after the first replace, instead of only matching on two backslashes.

dominikg commented 4 months ago

included in #179