-
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(reporter): add config formatError function #2313
feat(reporter): add config formatError function #2313
Conversation
@@ -41,6 +41,10 @@ var processArgs = function (argv, options, fs, path) { | |||
options.failOnEmptyTestSuite = options.failOnEmptyTestSuite === 'true' | |||
} | |||
|
|||
if (helper.isString(options.formatError)) { | |||
options.formatError = options.formatError = require(options.formatError) | |||
} |
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.
CLI support via requiring a path that exports a formatError()
function.
I'd fix/add tests if I could, but they are failing when I run them on master as well:
The file is clearly there, so I'm not sure what is going on. I'm running Full output:
|
It might be worth it to include an option for removing node_modules, and another for removing compiled sources. This are the most common use cases and complaints. We could accept an array or a function. There would be a filter function each option and we'd just map through them. It might look something like: // some pre-bundled filters
{ formatError: ['remove-node-modules', 'remove-compiled-sources'] }
// or your own function
{ formatError: (msg) => msg } --format-error remove-node-modules,remove-compiled-sources
--format-error ./some-error-formatter.js |
Hi @levithomason, I encountered the issue with Most likely this is it:
|
Hm, I've never used |
It's There are similar instructions in the contribution guide http://karma-runner.github.io/1.0/dev/making-changes.html Try this:
|
Yes, to get all the tests being actually run properly make sure to do the linking part as mentioned above. |
b78e306
to
caec040
Compare
@dignifiedquire I believe it's ready for review. Tests and linting passed locally, just rebased to master. |
@dignifiedquire I understand busy. Do you have any ETA on this PR? |
Sorry for the delay, will review this week |
Much appreciated, thanks. |
caec040
to
ce2cbdc
Compare
Rebased to latest master. |
@@ -41,6 +41,16 @@ var processArgs = function (argv, options, fs, path) { | |||
options.failOnEmptyTestSuite = options.failOnEmptyTestSuite === 'true' | |||
} | |||
|
|||
if (helper.isString(options.formatError)) { | |||
var required = require(options.formatError) |
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.
It would be good to wrap this into a try catch
and provide a helpful error message if it fails.
9691a14
to
2c673da
Compare
@dignifiedquire ready for review |
Tests pass locally and the CI failure seem odd |
Retried the build via PR close/open to no avail, still getting this:
I edited the commit that removed the package.json git hooks and force pushed it. I'm wondering if CI is somehow confused on the force pushed history? |
Looking at the CI failures they look like valid test failures |
Hm, the only change was replacing the package.json hooks. Also, tests pass locally. So I'm not sure what else to try there. Ideas? |
Restarted them, lets see what happens |
2c673da
to
c88366e
Compare
c88366e
to
1f5d55f
Compare
@dignifiedquire looks like we're good to go. |
@dignifiedquire bump, this is labeled needs feedback but actually needs review. |
@levithomason sorry about that, forgot that it was already green :) |
No worries, thanks for the quick response and merge. When do you suspect this will get released? |
I think I will make a release later today |
Fantastic, thanks much. This is going to improve our workflow dramatically. |
This is awesome! |
Fixes #2119. This PR allows a
formatError
config function. The function receives the entire error message as its only argument. It returns the new error message.