-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat(config): improve karma.config.parseConfig
error handling
#3635
feat(config): improve karma.config.parseConfig
error handling
#3635
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Before I clean up comments and attempt to write tests for the new code, I was hoping to get feedback on this first attempt. |
✅ Build karma 2885 completed (commit efd3debc07 by @npetruzzelli) |
✅ Build karma 488 completed (commit efd3debc07 by @npetruzzelli) |
✅ Build karma 487 completed (commit efd3debc07 by @npetruzzelli) |
@googlebot I signed it! |
❌ Build karma 489 failed (commit 2e2583226a by @npetruzzelli) |
❌ Build karma 2886 failed (commit 2e2583226a by @npetruzzelli) |
❌ Build karma 488 failed (commit 2e2583226a by @npetruzzelli) |
✅ Build karma 490 completed (commit cdc64a3510 by @npetruzzelli) |
✅ Build karma 2887 completed (commit cdc64a3510 by @npetruzzelli) |
✅ Build karma 489 completed (commit cdc64a3510 by @npetruzzelli) |
✅ Build karma 2888 completed (commit 3a1cd83c70 by @npetruzzelli) |
✅ Build karma 490 completed (commit 3a1cd83c70 by @npetruzzelli) |
✅ Build karma 491 completed (commit 3a1cd83c70 by @npetruzzelli) |
I wasn't sure if you intended for function fail (logArgs, failOptions) {
const _logArgs = Array.isArray(logArgs) ? logArgs : [logArgs]
log.error(..._logArgs )
if (failOptions && failOptions.throwErrors === true) {
// ...
}
// in `parseConfig`
fail (message, parseOptions)
fail ([message, e], parseOptions)
// -- OR --
function fail (logArgs, throwErrors) {
const _logArgs = Array.isArray(logArgs) ? logArgs : [logArgs]
log.error(..._logArgs )
if (throwErrors === true) {
// ...
}
// -- OR --
function fail (throwErrors, ...logArgs) {
log.error(...logArgs )
if (throwErrors === true) {
// ...
} |
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.
Please also update the usage of parseConfig
in Karma's source code, so it does not rely on the deprecated behavior (last point in #3631 (comment)).
And add a unit test for parseConfig
function with throwErrors: true
.
Otherwise, it looks good 👍
Thanks!
Good to know! Let's keep it simple here and we can adjust the signature in the next PR (if/when necessary). |
✅ Build karma 495 completed (commit 078db6fc9f by @npetruzzelli) |
# [6.1.0](karma-runner/karma@v6.0.4...v6.1.0) (2021-02-03) ### Features * **config:** improve `karma.config.parseConfig` error handling ([karma-runner#3635](karma-runner#3635)) ([9dba1e2](karma-runner@9dba1e2))
This PR add the ability of Public API users of
parseConfig
to opt-in to throwing errors when a critical failure is encountered.The current behavior is to exit the process immediately, which denies the API consumer the ability to log or respond to the error at their application's level.
Related Issue: #3631