Skip to content

Commit 3e8b76e

Browse files
committed
Fix CLI snapshot filenames when options include paths
1 parent aef146f commit 3e8b76e

6 files changed

+5
-70
lines changed

Diff for: packages/cli/test/snapshots.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe("snapshots", async () => {
6262
});
6363

6464
for (const [tarball, options] of tests) {
65-
const fixture = tarball + (options ? ` ${options}` : "");
65+
const fixture = tarball + (options ? ` ${options.replace(/ .*[\\\/](?=[^\\\/]*$)/g, " ")}` : "");
6666
if (testFilter && !fixture.toLowerCase().includes(testFilter)) {
6767
continue;
6868
}
@@ -82,7 +82,7 @@ describe("snapshots", async () => {
8282
stderr = (error as SpawnSyncReturns<string>).stderr;
8383
exitCode = (error as SpawnSyncReturns<string>).status ?? 1;
8484
}
85-
const snapshotURL = new URL(`../snapshots/${fixture.replace(/\//g, "")}.md`, import.meta.url);
85+
const snapshotURL = new URL(`../snapshots/${fixture}.md`, import.meta.url);
8686
// prettier-ignore
8787
const expectedSnapshot = [
8888
`# ${fixture}`,
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [email protected] --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@[email protected]
1+
22

33
```
44
$ attw [email protected] --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@[email protected]

Diff for: packages/cli/test/snapshots/[email protected] --definitely-typed homerunnerworkarethetypeswrong.github.ioarethetypeswrong.github.iopackagescoretestfixtures@[email protected]

-33
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [email protected] --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@[email protected]
1+
22

33
```
44
$ attw [email protected] --definitely-typed /Users/andrew/Developer/arethetypeswrong.github.io/packages/core/test/fixtures/@[email protected]

Diff for: packages/cli/test/snapshots/[email protected] --definitely-typed homerunnerworkarethetypeswrong.github.ioarethetypeswrong.github.iopackagescoretestfixtures@[email protected]

-32
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [email protected] --include-entrypoints ./foo -f ascii
1+
# [email protected] --include-entrypoints foo -f ascii
22

33
```
44
$ attw [email protected] --include-entrypoints ./foo -f ascii

0 commit comments

Comments
 (0)