Skip to content

Commit

Permalink
fix error-on-fail test
Browse files Browse the repository at this point in the history
  • Loading branch information
ds300 committed Apr 25, 2023
1 parent 67f929b commit 02e16dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration-tests/error-on-fail/error-on-fail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn add $1
alias patch-package=./node_modules/.bin/patch-package

export NODE_ENV="development"
export CI=""
export CI="true"

(>&2 echo "SNAPSHOT: at dev time patch-package fails but returns 0")
if ! patch-package;
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/runIntegrationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export function runIntegrationTest({
{
cwd: tmpDir.name,
throwOnError: false,
env: {
...process.env,
PATCH_PACKAGE_INTEGRATION_TEST: "1",
},
shell: true,
},
)
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ if (argv.version || argv.v) {
} else {
console.log("Applying patches...")
const reverse = !!argv["reverse"]
// don't want to exit(1) on postinsall locally.
// don't want to exit(1) on postinstall locally.
// see https://github.com/ds300/patch-package/issues/86
const shouldExitWithError =
!!argv["error-on-fail"] || isCI || process.env.NODE_ENV === "test"
!!argv["error-on-fail"] ||
(isCI && !process.env.PATCH_PACKAGE_INTEGRATION_TEST) ||
process.env.NODE_ENV === "test"

const shouldExitWithWarning = !!argv["error-on-warn"]

Expand Down

0 comments on commit 02e16dc

Please sign in to comment.