Skip to content

Commit 2207bc6

Browse files
committed
avoid snapshot churn
1 parent 82d8fc4 commit 2207bc6

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

integration-tests/unexpected-patch-creation-failure/__snapshots__/unexpected-patch-creation-failure.test.ts.snap

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports[`Test unexpected-patch-creation-failure: patch-package fails to parse a
1010
1111
A diagnostic file was written to
1212
13-
/private/var/folders/kp/4q6sxzl17jq2p_d8pccptx7w0000gq/T/tmp-7498Qc45vBM0jh11/patch-package-error.json.gz
13+
./patch-package-error.json.gz
1414
1515
Please attach it to a github issue
1616
@@ -23,8 +23,3 @@ exports[`Test unexpected-patch-creation-failure: patch-package fails to parse a
2323
error Command failed with exit code 1.
2424
END SNAPSHOT"
2525
`;
26-
27-
exports[`Test unexpected-patch-creation-failure: the json file 1`] = `
28-
"SNAPSHOT: the json file
29-
{\\"error\\":{\\"message\\":\\"parse_1.blarseBlatchBlile is not a function\\",\\"stack\\":\\"TypeError: parse_1.blarseBlatchBlile is not a function\\\\n at Object.makePatch (/private/var/folders/kp/4q6sxzl17jq2p_d8pccptx7w0000gq/T/tmp-7498Qc45vBM0jh11/node_modules/patch-package/dist/makePatch.js:112:21)\\\\n at /private/var/folders/kp/4q6sxzl17jq2p_d8pccptx7w0000gq/T/tmp-7498Qc45vBM0jh11/node_modules/patch-package/dist/index.js:48:25\\\\n at Array.forEach (<anonymous>)\\\\n at Object.<anonymous> (/private/var/folders/kp/4q6sxzl17jq2p_d8pccptx7w0000gq/T/tmp-7498Qc45vBM0jh11/node_modules/patch-package/dist/index.js:47:22)\\\\n at Module._compile (internal/modules/cjs/loader.js:689:30)\\\\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)\\\\n at Module.load (internal/modules/cjs/loader.js:599:32)\\\\n at tryModuleLoad (internal/modules/cjs/loader.js:538:12)\\\\n at Function.Module._load (internal/modules/cjs/loader.js:530:3)\\\\n at Module.require (internal/modules/cjs/loader.js:637:17)\\"},\\"patch\\":\\"diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js\\\\nindex e90aec3..f2b8b0a 100644\\\\n--- a/node_modules/left-pad/index.js\\\\n+++ b/node_modules/left-pad/index.js\\\\n@@ -4,7 +4,7 @@\\\\n * To Public License, Version 2, as published by Sam Hocevar. See\\\\n * http://www.wtfpl.net/ for more details. */\\\\n 'use strict';\\\\n-module.exports = leftPad;\\\\n+module.exports = patchPackage;\\\\n \\\\n var cache = [\\\\n '',\\\\n@@ -19,7 +19,7 @@ var cache = [\\\\n ' '\\\\n ];\\\\n \\\\n-function leftPad (str, len, ch) {\\\\n+function patchPackage (str, len, ch) {\\\\n // convert \`str\` to a \`string\`\\\\n str = str + '';\\\\n // \`len\` is the \`pad\`'s length now\\\\n\\"}END SNAPSHOT"
30-
`;

integration-tests/unexpected-patch-creation-failure/unexpected-patch-creation-failure.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ ls ./patch-package-error.json.gz
2929
echo "and it can be unzipped"
3030
gzip -d ./patch-package-error.json.gz
3131

32-
echo "SNAPSHOT: the json file"
33-
cat ./patch-package-error.json
34-
echo "END SNAPSHOT"
32+
echo "the json file is valid json"
33+
node -e 'JSON.parse(fs.readFileSync("./patch-package-error.json").toString())'

src/makePatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export function makePatch({
194194
this was unintentional.
195195
`)
196196
} else {
197-
const outPath = join(process.cwd(), "patch-package-error.json.gz")
197+
const outPath = "./patch-package-error.json.gz"
198198
writeFileSync(
199199
outPath,
200200
gzipSync(

0 commit comments

Comments
 (0)