Skip to content

Commit

Permalink
Strip more absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Aug 7, 2024
1 parent 3e8b76e commit 782c640
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions packages/cli/test/snapshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("snapshots", async () => {
});

for (const [tarball, options] of tests) {
const fixture = tarball + (options ? ` ${options.replace(/ .*[\\\/](?=[^\\\/]*$)/g, " ")}` : "");
const fixture = tarball + (options ? ` ${stripPaths(options)}` : "");
if (testFilter && !fixture.toLowerCase().includes(testFilter)) {
continue;
}
Expand All @@ -88,7 +88,7 @@ describe("snapshots", async () => {
`# ${fixture}`,
"",
"```",
`$ attw ${tarball} ${options ?? defaultOpts}`,
`$ attw ${tarball} ${stripPaths(options ?? defaultOpts)}`,
"",
[stdout, stderr].filter(Boolean).join("\n"),
"",
Expand Down Expand Up @@ -116,3 +116,7 @@ describe("snapshots", async () => {
});
}
});

function stripPaths(input: string): string {
return input.replace(/ .*[\\\/](?=[^\\\/]*$)/g, " ");
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# big.js@6.2.1.tgz --definitely-typed @types__big.js@6.2.0.tgz

```
$ attw big.js@6.2.1.tgz --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@types__big.js@6.2.0.tgz
$ attw big.js@6.2.1.tgz --definitely-typed @types__big.js@6.2.0.tgz
big.js v6.2.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# react@18.2.0.tgz --definitely-typed @types__react@18.2.21.tgz

```
$ attw react@18.2.0.tgz --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@types__react@18.2.21.tgz
$ attw react@18.2.0.tgz --definitely-typed @types__react@18.2.21.tgz
react v18.2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# vue@3.3.4.tgz --include-entrypoints foo -f ascii

```
$ attw vue@3.3.4.tgz --include-entrypoints ./foo -f ascii
$ attw vue@3.3.4.tgz --include-entrypoints foo -f ascii
vue v3.3.4
Expand Down

0 comments on commit 782c640

Please sign in to comment.