-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
RuleTesters AssertionError.actual is not being displayed #5
Comments
This looks to be a problem with AVA, but for now we can workaround it with: 'use strict';
var RuleTester = require('eslint').RuleTester;
module.exports = function (test, options) {
RuleTester.describe = function (text, method) {
RuleTester.it.validity = text;
return method.apply(this);
};
RuleTester.it = function (text, method) {
test(RuleTester.it.validity + ': ' + text, () => {
try {
method();
} catch (err) {
err.message += `\n\nActual:\n${err.actual}\n\nExpected:\n${err.expected}`;
throw err;
}
});
};
return new RuleTester(options);
}; @jfmengels Would you be open to a pull request? |
@novemberborn How should we handle this in AVA? I guess this becomes more complicated now that we prerender the assertion messages. |
My in-progress formatter would show additional error properties, besides just the name and message. That would be the generic fix. We could also recognize arbitrary |
Yes, we should do that. |
Hey, i am stucked implementing the fix for avajs/eslint-plugin-ava#21
I am not able to debug my fix since ava outputs only the expected value alongside with the error message:
I tried to find out how to fix that and i was even thinking about patching eslint, to let the error message contain more information. Digging deeper i found out that RuleTester uses the common assert library's
equal
to match the expectedoutput
with thefixResult.output
. For me it seems like Ava should also printerror.actual
in the case a fix-rule is tested.I was currently not able to find out where the best look for a point to improve the output of eslints-fix tests. And i somehow thought this might be the rightplace since #3 discusses a topic around fixes, too.
I would appreciate any hint how to improve this.
The text was updated successfully, but these errors were encountered: