Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 22f068a

Browse files
jablkoelibarzilay
authored andcommitted
Process scrubbed response so created fixtures pass
Because `create-fixture.ts` and `fixturedActions.test.ts` process different responses (unscrubbed and scrubbed) they can have different outputs, e.g., different mutations. The differences cause freshly created fixtures to fail, requiring a subsequent `--updateSnapshot`. This change makes `create-fixture.ts` process the same (scrubbed) response as `fixturedActions.test.ts`, resulting in the same outputs and the fixture passing.
1 parent 695786d commit 22f068a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/commands/create-fixture.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ export default async function main(directory: string, overwriteInfo: boolean) {
1818
if (!existsSync(fixturePath)) mkdirSync(fixturePath);
1919

2020
const jsonFixturePath = join(fixturePath, "_response.json");
21-
let response;
2221
if (overwriteInfo || !existsSync(jsonFixturePath)) {
23-
response = await queryPRInfo(prNumber);
24-
writeJsonSync(jsonFixturePath, response);
25-
} else {
26-
response = JSON.parse(readFileSync(jsonFixturePath, "utf8"));
22+
writeJsonSync(jsonFixturePath, await queryPRInfo(prNumber));
2723
}
24+
const response = JSON.parse(readFileSync(jsonFixturePath, "utf8"));
2825

2926
const filesJSONPath = join(fixturePath, "_files.json");
3027
const filesFetched: {[expr: string]: string | undefined} = {};

0 commit comments

Comments
 (0)