Skip to content

Commit d68b6af

Browse files
committed
fix tests
1 parent df30019 commit d68b6af

File tree

47 files changed

+296
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+296
-213
lines changed

β€Žintegration-tests/append-patches/__snapshots__/append-patches.test.ts.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,17 @@ END SNAPSHOT"
8282

8383
exports[`Test append-patches: 07: patch-package fails when a patch in the sequence is invalid 1`] = `
8484
"SNAPSHOT: patch-package fails when a patch in the sequence is invalid
85+
patch-package 0.0.0
86+
β€’ Creating temporary folder
87+
β€’ Installing [email protected] with npm
88+
β€’ Diffing your files with clean files
8589
Failed to apply patch left-pad+1.3.0+001+FirstPatch.patch to left-pad
8690
END SNAPSHOT"
8791
`;
8892

8993
exports[`Test append-patches: 08: --append is not compatible with --create-issue 1`] = `
9094
"SNAPSHOT: --append is not compatible with --create-issue
95+
patch-package 0.0.0
9196
--create-issue is not compatible with --append.
9297
END SNAPSHOT"
9398
`;

β€Žintegration-tests/append-patches/append-patches.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ echo "END SNAPSHOT"
7171
echo "if one of the patches in the sequence is invalid, the sequence is not applied"
7272
npx replace 'use strict' 'use bananas' patches/*FirstPatch.patch
7373

74-
(>&2 echo "SNAPSHOT: patch-package fails when a patch in the sequence is invalid")
74+
echo "SNAPSHOT: patch-package fails when a patch in the sequence is invalid"
7575
if patch-package left-pad --append 'Bananas' ; then
7676
exit 1
7777
fi
78-
(>&2 echo "END SNAPSHOT")
78+
echo "END SNAPSHOT"
7979

80-
(>&2 echo "SNAPSHOT: --append is not compatible with --create-issue")
80+
echo "SNAPSHOT: --append is not compatible with --create-issue"
8181
if patch-package left-pad --append 'Bananas' --create-issue ; then
8282
exit 1
8383
fi
84-
(>&2 echo "END SNAPSHOT")
84+
echo "END SNAPSHOT"

β€Žintegration-tests/apply-multiple-patches/__snapshots__/apply-multiple-patches.test.ts.snap

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ END SNAPSHOT"
1313
exports[`Test apply-multiple-patches: 01: patch-package stores a state file to list the patches that have been applied 1`] = `
1414
"SNAPSHOT: patch-package stores a state file to list the patches that have been applied
1515
{
16+
\\"isRebasing\\": false,
1617
\\"patches\\": [
1718
{
1819
\\"didApply\\": true,
@@ -30,62 +31,80 @@ exports[`Test apply-multiple-patches: 01: patch-package stores a state file to l
3031
\\"patchFilename\\": \\"left-pad+1.3.0+004+goodbye.patch\\"
3132
}
3233
],
33-
\\"version\\": 0
34+
\\"version\\": 1
3435
}END SNAPSHOT"
3536
`;
3637

37-
exports[`Test apply-multiple-patches: 02: patch-package only applies the first patch if the second of three is invalid 1`] = `
38+
exports[`Test apply-multiple-patches: 02: patch-package fails when a patch in the sequence is invalid 1`] = `
39+
"SNAPSHOT: patch-package fails when a patch in the sequence is invalid
40+
patch-package 0.0.0
41+
Applying patches...
42+
[email protected] (1 hello) βœ”
43+
44+
β›” ERROR
45+
46+
Failed to apply patch file left-pad+1.3.0+002+broken.patch.
47+
48+
If this patch file is no longer useful, delete it and run
49+
50+
patch-package
51+
52+
Otherwise you should open node_modules/left-pad, manually apply the changes from the patch file, and run
53+
54+
patch-package left-pad
55+
56+
to update the patch file.
57+
58+
END SNAPSHOT"
59+
`;
60+
61+
exports[`Test apply-multiple-patches: 03: patch-package only applies the first patch if the second of three is invalid 1`] = `
3862
"SNAPSHOT: patch-package only applies the first patch if the second of three is invalid
3963
patch-package 0.0.0
4064
Applying patches...
4165
[email protected] (1 hello) βœ”
66+
67+
β›” ERROR
68+
69+
Failed to apply patch file left-pad+1.3.0+002+broken.patch.
70+
71+
If this patch file is no longer useful, delete it and run
72+
73+
patch-package
74+
75+
Otherwise you should open node_modules/left-pad, manually apply the changes from the patch file, and run
76+
77+
patch-package left-pad
78+
79+
to update the patch file.
80+
4281
END SNAPSHOT"
4382
`;
4483

45-
exports[`Test apply-multiple-patches: 03: patch-package stores a state file of only the first patch if there was an error 1`] = `
84+
exports[`Test apply-multiple-patches: 04: patch-package stores a state file of only the first patch if there was an error 1`] = `
4685
"SNAPSHOT: patch-package stores a state file of only the first patch if there was an error
4786
{
87+
\\"isRebasing\\": true,
4888
\\"patches\\": [
4989
{
5090
\\"didApply\\": true,
5191
\\"patchContentHash\\": \\"404c604ed830db6a0605f86cb9165ced136848f70986b23bf877bcf38968c1c9\\",
5292
\\"patchFilename\\": \\"left-pad+1.3.0+001+hello.patch\\"
93+
},
94+
{
95+
\\"didApply\\": false,
96+
\\"patchContentHash\\": \\"9c5c141e2578b4178fd57dd7726488c2f7eab32e23a7848701da29dcb371b9f2\\",
97+
\\"patchFilename\\": \\"left-pad+1.3.0+002+broken.patch\\"
5398
}
5499
],
55-
\\"version\\": 0
100+
\\"version\\": 1
56101
}END SNAPSHOT"
57102
`;
58103

59-
exports[`Test apply-multiple-patches: 04: patch-package fails when a patch in the sequence is invalid 1`] = `
60-
"SNAPSHOT: patch-package fails when a patch in the sequence is invalid
61-
62-
**ERROR** Failed to apply patch for package left-pad at path
63-
64-
node_modules/left-pad
65-
66-
This error was caused because patch-package cannot apply the following patch file:
67-
68-
patches/left-pad+1.3.0+002+broken.patch
69-
70-
Try removing node_modules and trying again. If that doesn't work, maybe there was
71-
an accidental change made to the patch file? Try recreating it by manually
72-
editing the appropriate files and running:
73-
74-
patch-package left-pad
75-
76-
If that doesn't work, then it's a bug in patch-package, so please submit a bug
77-
report. Thanks!
78-
79-
https://github.com/ds300/patch-package/issues
80-
81-
82-
---
83-
patch-package finished with 1 error(s).
84-
END SNAPSHOT"
85-
`;
86-
87104
exports[`Test apply-multiple-patches: 05: patch-package fails when a patch file is removed 1`] = `
88105
"SNAPSHOT: patch-package fails when a patch file is removed
106+
patch-package 0.0.0
107+
Applying patches...
89108
Error: The patches for left-pad have changed. You should reinstall your node_modules folder to make sure the package is up to date
90109
END SNAPSHOT"
91110
`;

β€Žintegration-tests/apply-multiple-patches/apply-multiple-patches.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ cp *broken.patch patches/
2626

2727
rm -rf node_modules
2828
npm install
29-
(>&2 echo "SNAPSHOT: patch-package fails when a patch in the sequence is invalid")
29+
echo "SNAPSHOT: patch-package fails when a patch in the sequence is invalid"
3030
if patch-package
3131
then
3232
exit 1
3333
fi
34-
(>&2 echo "END SNAPSHOT")
34+
echo "END SNAPSHOT"
3535

3636

3737
echo "SNAPSHOT: patch-package only applies the first patch if the second of three is invalid"
@@ -47,9 +47,9 @@ echo "END SNAPSHOT"
4747

4848

4949
rm patches/*hello.patch
50-
(>&2 echo "SNAPSHOT: patch-package fails when a patch file is removed")
50+
echo "SNAPSHOT: patch-package fails when a patch file is removed"
5151
if patch-package
5252
then
5353
exit 1
5454
fi
55-
(>&2 echo "END SNAPSHOT")
55+
echo "END SNAPSHOT"

β€Žintegration-tests/broken-patch-file/__snapshots__/broken-patch-file.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
exports[`Test broken-patch-file: 00: patch-package fails when patch file is invalid 1`] = `
44
"SNAPSHOT: patch-package fails when patch file is invalid
5+
patch-package 0.0.0
6+
Applying patches...
57
68
**ERROR** Failed to apply patch for package left-pad at path
79

β€Žintegration-tests/broken-patch-file/broken-patch-file.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ echo "add patch-package"
55
yarn add $1
66
alias patch-package=./node_modules/.bin/patch-package
77

8-
(>&2 echo "SNAPSHOT: patch-package fails when patch file is invalid")
8+
echo "SNAPSHOT: patch-package fails when patch file is invalid"
99
if patch-package
1010
then
1111
exit 1
1212
fi
13-
(>&2 echo "END SNAPSHOT")
13+
echo "END SNAPSHOT"

β€Žintegration-tests/collate-errors/__snapshots__/collate-errors.test.ts.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
exports[`Test collate-errors: 00: left-pad, lodash, and zfs apply 1`] = `
44
"SNAPSHOT: left-pad, lodash, and zfs apply
5+
SNAPSHOT: underscore does not apply, left-pad warns
56
patch-package 0.0.0
67
Applying patches...
78
89
910
10-
END SNAPSHOT"
11-
`;
12-
13-
exports[`Test collate-errors: 01: underscore does not apply, left-pad warns 1`] = `
14-
"SNAPSHOT: underscore does not apply, left-pad warns
1511
1612
Warning: patch-package detected a patch file version mismatch
1713

β€Žintegration-tests/collate-errors/collate-errors.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ yarn add $1
66
alias patch-package=./node_modules/.bin/patch-package
77

88
echo "SNAPSHOT: left-pad, lodash, and zfs apply"
9-
(>&2 echo "SNAPSHOT: underscore does not apply, left-pad warns")
9+
echo "SNAPSHOT: underscore does not apply, left-pad warns"
1010
if patch-package;
1111
then
1212
exit 1
1313
fi
14-
(>&2 echo "END SNAPSHOT")
14+
echo "END SNAPSHOT"
1515
echo "END SNAPSHOT"

β€Žintegration-tests/dev-only-patches/__snapshots__/dev-only-patches.test.ts.snap

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@ Skipping dev-only [email protected] βœ”
99
END SNAPSHOT"
1010
`;
1111

12-
exports[`Test dev-only-patches: 01: fake-package should be skipped 1`] = `
13-
"SNAPSHOT: fake-package should be skipped
12+
exports[`Test dev-only-patches: 01: patch-package fails to find fake-package 1`] = `
13+
"SNAPSHOT: patch-package fails to find fake-package
1414
patch-package 0.0.0
1515
Applying patches...
16-
Skipping dev-only [email protected] βœ”
1716
1817
Skipping dev-only [email protected] βœ”
19-
END SNAPSHOT"
20-
`;
21-
22-
exports[`Test dev-only-patches: 02: patch-package fails to find fake-package 1`] = `
23-
"SNAPSHOT: patch-package fails to find fake-package
2418
Error: Patch file found for package fake-package which is not present at node_modules/fake-package
2519
2620
If this package is a dev dependency, rename the patch file to
@@ -31,3 +25,13 @@ Error: Patch file found for package fake-package which is not present at node_mo
3125
patch-package finished with 1 error(s).
3226
END SNAPSHOT"
3327
`;
28+
29+
exports[`Test dev-only-patches: 02: fake-package should be skipped 1`] = `
30+
"SNAPSHOT: fake-package should be skipped
31+
patch-package 0.0.0
32+
Applying patches...
33+
Skipping dev-only [email protected] βœ”
34+
35+
Skipping dev-only [email protected] βœ”
36+
END SNAPSHOT"
37+
`;

β€Žintegration-tests/dev-only-patches/dev-only-patches.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ echo "END SNAPSHOT"
1616
echo "create fake-package+3.0.0.patch"
1717
cp patches/slash+3.0.0.patch patches/fake-package+3.0.0.patch
1818

19-
(>&2 echo "SNAPSHOT: patch-package fails to find fake-package")
19+
echo "SNAPSHOT: patch-package fails to find fake-package"
2020
if patch-package
2121
then
2222
exit 1
2323
fi
24-
(>&2 echo "END SNAPSHOT")
24+
echo "END SNAPSHOT"
2525

2626
echo "rename fake-package patch file to .dev.patch"
2727
mv patches/fake-package+3.0.0.patch patches/fake-package+3.0.0.dev.patch

0 commit comments

Comments
Β (0)