-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Fix: forever on command line #360
Changes from all commits
591fa4e
9623ffd
c813230
0254515
368daa5
cc19eac
3a9b621
d5c38da
09fb3bb
c9cb93d
b458e69
5753cba
45ad52a
02a4c46
658902f
d155de8
7c737df
30157bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
esm: false | ||
ts: false | ||
jsx: false | ||
flow: false | ||
timeout: 900 | ||
coverage: true | ||
branches: 86 | ||
functions: 84 | ||
lines: 87 | ||
statements: 87 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,9 +239,17 @@ function start (argv) { | |
}) | ||
}) | ||
} else { | ||
initJob(argv).catch((err) => { | ||
// if forever is true then a promise is not returned and we need to try ... catch errors | ||
try { | ||
const tracker = initJob(argv) | ||
if (tracker.then) { | ||
tracker.catch((err) => { | ||
console.error(err.message) | ||
}) | ||
} | ||
} catch (err) { | ||
console.error(err.message) | ||
}) | ||
} | ||
Comment on lines
+242
to
+252
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The actual fix for |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ const isValidFn = (opt) => (!opt || typeof opt === 'function' || typeof opt === | |
|
||
const lessThanOneError = (label) => new Error(`${label} can not be less than 1`) | ||
const greaterThanZeroError = (label) => new Error(`${label} must be greater than 0`) | ||
const minIfPresent = (val, min) => val && val < min | ||
const minIfPresent = (val, min) => val !== null && val < min | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This used to return |
||
|
||
function safeRequire (path) { | ||
if (typeof path === 'string') { | ||
|
@@ -83,8 +83,15 @@ module.exports = function validateOpts (opts, cbPassedIn) { | |
} | ||
|
||
if (typeof opts.duration === 'string') { | ||
if (/[a-zA-Z]/.exec(opts.duration)) opts.duration = timestring(opts.duration) | ||
else opts.duration = Number(opts.duration.trim()) | ||
if (/[a-zA-Z]/.exec(opts.duration)) { | ||
try { | ||
opts.duration = timestring(opts.duration) | ||
} catch (error) { | ||
return error | ||
} | ||
Comment on lines
+86
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
} else { | ||
opts.duration = Number(opts.duration.trim()) | ||
} | ||
} | ||
|
||
if (typeof opts.duration !== 'number') { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
"sinon": "^10.0.1", | ||
"split2": "^3.2.2", | ||
"standard": "^16.0.3", | ||
"tap": "^14.10.8" | ||
"tap": "^15.0.2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. considering that 90% of the changes are tap-related, you could have considered keeping the tap upgrade out of this change and do it standalone instead |
||
}, | ||
"dependencies": { | ||
"chalk": "^4.1.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ if (!win) { | |
} | ||
|
||
t.autoend(false) | ||
t.tearDown(function () { | ||
t.teardown(function () { | ||
child.kill() | ||
}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: if rather than handling this in a special way we made the forever code path return a promise too, so that we don't have to handle special cases here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was my original approach but I ran into problems with the reporting. I just tried again now and it is working 😕 . Would you like me to investigate further or shall I merge as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you. My personal preference would be to do it "properly", but I'm not a maintainer of the repo either so I leave that to you and the maintainers.