-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from ds300/fix/fail-on-unused-patch-file
Fail when patch found for uninstalled package
- Loading branch information
Showing
8 changed files
with
89 additions
and
14 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
integration-tests/fails-when-no-package/__snapshots__/fails-when-no-package.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Test fails-when-no-package: no package present failure 1`] = ` | ||
"SNAPSHOT: no package present failure | ||
Error: Patch file found for package left-pad which is not present at node_modules/left-pad | ||
error Command failed with exit code 1. | ||
END SNAPSHOT" | ||
`; |
11 changes: 11 additions & 0 deletions
11
integration-tests/fails-when-no-package/fails-when-no-package.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# make sure errors stop the script | ||
set -e | ||
|
||
echo "add patch-package" | ||
yarn add $1 | ||
|
||
(>&2 echo "SNAPSHOT: no package present failure") | ||
if yarn patch-package; then | ||
exit 1 | ||
fi | ||
(>&2 echo "END SNAPSHOT") |
5 changes: 5 additions & 0 deletions
5
integration-tests/fails-when-no-package/fails-when-no-package.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { runIntegrationTest } from "../runIntegrationTest" | ||
runIntegrationTest({ | ||
projectName: "fails-when-no-package", | ||
shouldProduceSnapshots: true, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "fails-when-no-package", | ||
"version": "1.0.0", | ||
"description": "integration test for patch-package", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": {} | ||
} |
13 changes: 13 additions & 0 deletions
13
integration-tests/fails-when-no-package/patches/left-pad+1.1.3.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js | ||
index 26f73ff..60f3f56 100644 | ||
--- a/node_modules/left-pad/index.js | ||
+++ b/node_modules/left-pad/index.js | ||
@@ -4,7 +4,7 @@ | ||
* To Public License, Version 2, as published by Sam Hocevar. See | ||
* http://www.wtfpl.net/ for more details. */ | ||
'use strict'; | ||
-module.exports = leftPad; | ||
+module.exports = patch-package; | ||
|
||
var cache = [ | ||
'', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js | ||
index 26f73ff..60f3f56 100644 | ||
--- a/node_modules/left-pad/index.js | ||
+++ b/node_modules/left-pad/index.js | ||
@@ -4,7 +4,7 @@ | ||
* To Public License, Version 2, as published by Sam Hocevar. See | ||
* http://www.wtfpl.net/ for more details. */ | ||
'use strict'; | ||
-module.exports = leftPad; | ||
+module.exports = patch-package; | ||
|
||
var cache = [ | ||
'', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters