-
-
Notifications
You must be signed in to change notification settings - Fork 295
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 #345 from mvargeson/mvargeson/issue-314/error-on-warn
Add --error-on-warn flag to exit 1 on warnings
- Loading branch information
Showing
8 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
integration-tests/error-on-warn/__snapshots__/error-on-warn.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,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Test error-on-warn: at dev time patch-package warns but returns 0 1`] = ` | ||
"SNAPSHOT: at dev time patch-package warns but returns 0 | ||
Warning: patch-package detected a patch file version mismatch | ||
Don't worry! This is probably fine. The patch was still applied | ||
successfully. Here's the deets: | ||
Patch file created for | ||
left-pad@1.1.2 | ||
applied to | ||
left-pad@1.1.3 | ||
At path | ||
node_modules/left-pad | ||
This warning is just to give you a heads-up. There is a small chance of | ||
breakage even though the patch was applied successfully. Make sure the package | ||
still behaves like you expect (you wrote tests, right?) and then run | ||
patch-package left-pad | ||
to update the version in the patch file name and make this warning go away. | ||
--- | ||
patch-package finished with 1 warning(s). | ||
END SNAPSHOT" | ||
`; |
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,22 @@ | ||
# make sure errors stop the script | ||
set -e | ||
|
||
echo "add patch-package" | ||
yarn add $1 | ||
alias patch-package=./node_modules/.bin/patch-package | ||
|
||
export NODE_ENV="development" | ||
export CI="" | ||
|
||
(>&2 echo "SNAPSHOT: at dev time patch-package warns but returns 0") | ||
if ! patch-package; | ||
then | ||
exit 1 | ||
fi | ||
(>&2 echo "END SNAPSHOT") | ||
|
||
echo "adding --error-on-warn forces patch-package to return 1 at dev time" | ||
if patch-package --error-on-warn; | ||
then | ||
exit 1 | ||
fi |
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: "error-on-warn", | ||
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,11 @@ | ||
{ | ||
"name": "error-on-warn", | ||
"version": "1.0.0", | ||
"description": "integration test for patch-package", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"left-pad": "1.1.3" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
integration-tests/error-on-warn/patches/left-pad+1.1.2.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 | ||
@@ -7,7 +7,7 @@ | ||
module.exports = leftPad; | ||
|
||
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,8 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
left-pad@1.1.3: | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a" | ||
integrity sha1-YS9hwDPzqeCOk58crr7qQbbzGZo= |
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
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