-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
pass file info to rules #42
pass file info to rules #42
Conversation
Sorry it took so long 😄 |
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.
Sorry it took so long 😄
No worries, better late then never 😃
The implementation looks good. Just have one comment to potentially improve clarity and/or extensibility. Also, as mentioned in the issue, this is ideally tested as well. I'm a new maintainer and not too familiar with the test suite for the project, but I think a test like the following in custom.spec.js
could be a start:
it("should provide file information", function(done){
testSucceeds([
(reporter, $, ast, info) => {
expect(info).toExist();
expect(info.hasOwnProperty("path")).toBe(true);
done();
}
]);
});
I added a test as you asked. I struggled to get the test to work properly (it would dump a load of junk to the console) using the format you suggested, so instead i throw an Error if either |
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.
I added a test as you asked.
Thanks!
I struggled to get the test to work properly (it would dump a load of junk to the console) using the format you suggested, so instead i throw an Error if either
info
, orinfo.filepath
is not present. Hope that's ok!
Apologies if my test didn't work for you. Anyway, I do quite like the way you did it so no problems there.
Could you just remove the use of .only
from and add semicolons ;
where they're missing in the test suite?
3165115
to
a6b70c0
Compare
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 looks good to me now @WickyNilliams, thanks!
I'll leave this open for a few more days (at least until 2021-11-15) to give @birjolaxew a chance to review it as well.
Haven't had the chance to actually test, but the code looks good to me. I'll let @ericcornelissen merge. |
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes #30