Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change process.exit(testResults.totalFailed) to process.exit(0) #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const args = arg(
'-n': Number,
'--until-passes': Boolean,
'--rerun-failed-only': Boolean,
'--allow-post-hook': Boolean,
},
{ permissive: true },
)
Expand All @@ -29,6 +30,8 @@ const untilPasses = '--until-passes' in args ? args['--until-passes'] : false
const rerunFailedOnly =
'--rerun-failed-only' in args ? args['--rerun-failed-only'] : false

const allowPostHook = '--allow-post-hook' in args ? args['--allow-post-hook'] : false

console.log('%s will repeat Cypress command %d time(s)', name, repeatNtimes)

if (untilPasses) {
Expand All @@ -39,6 +42,10 @@ if (rerunFailedOnly) {
console.log('%s it only reruns specs which have failed', name)
}

if (allowPostHook) {
console.log('%s allow post-hook scripts to run after failing tests', name)
}

/**
* Quick and dirty deep clone
*/
Expand Down Expand Up @@ -144,13 +151,14 @@ parseArguments()
console.error('%s run %d of %d failed', name, k + 1, n)
if (k === n - 1) {
console.error('%s no more attempts left', name)
process.exit(testResults.totalFailed)
allowPostHook ? process.exit(0): process.exit(testResults.totalFailed)

}
} else {
if (testResults.totalFailed) {
console.error('%s run %d of %d failed', name, k + 1, n)
if (!rerunFailedOnly || isLastRun) {
process.exit(testResults.totalFailed)
allowPostHook ? process.exit(0): process.exit(testResults.totalFailed)
}
}
}
Expand Down