diff --git a/integration-tests/error-on-fail/error-on-fail.sh b/integration-tests/error-on-fail/error-on-fail.sh index 137b5601..ee3b7635 100755 --- a/integration-tests/error-on-fail/error-on-fail.sh +++ b/integration-tests/error-on-fail/error-on-fail.sh @@ -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; diff --git a/integration-tests/runIntegrationTest.ts b/integration-tests/runIntegrationTest.ts index 4b176cf8..7708a450 100644 --- a/integration-tests/runIntegrationTest.ts +++ b/integration-tests/runIntegrationTest.ts @@ -40,6 +40,10 @@ export function runIntegrationTest({ { cwd: tmpDir.name, throwOnError: false, + env: { + ...process.env, + PATCH_PACKAGE_INTEGRATION_TEST: "1", + }, shell: true, }, ) diff --git a/src/index.ts b/src/index.ts index cfede961..aaddf4f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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"]