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
Chore: Add a script for testing with more control #12444
Conversation
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.
Looks good to me, but I'd like another set of eyes on this. Thanks for contributing!
I did leave one question, but it's not a blocker.
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"main": "./lib/api.js", | |||
"scripts": { | |||
"test": "node Makefile.js test", | |||
"test:cli": "./node_modules/.bin/mocha", |
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.
Would it work to simply say "mocha" 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.
It takes me quite a while to think about the naming and I can't think of a good one.
Maybe mocha
works better.
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.
Ack, I apologize, I wasn't clear.
I meant to say that you shouldn't need to prefix the mocha command:
"test:cli": "mocha"
This is because npm scripts should have the ./node_modules/.bin
added to the path environment variable.
I like the script name test:cli
. It's generic, and we wouldn't need to change it if we moved away from mocha.
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 apologize, I miscommunicated in my last review.
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"main": "./lib/api.js", | |||
"scripts": { | |||
"test": "node Makefile.js test", | |||
"mocha": "./node_modules/.bin/mocha", |
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.
My apologies, I meant to say you could get rid of the path prefix due to how npm run
works.
"test:cli": "mocha"
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.
Oh sorry, I see
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.
No need to apologize- this was my fault.
7ab55c1
to
b886043
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.
Looks good to me, thanks!
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.
LGTM, though I think we can mark this as a chore since it's only for internal use.
Should we add |
I am slightly toward to "No" If the developers are split into two groups, familiar with the Mocha or not. But I believe you have much more context than I do so either way is fine for me. |
I'll go ahead and merge this as-is, without Thanks @fa93hws for contributing! |
What is the purpose of this pull request? (put an "X" next to item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain: Add a script to
package.json
What changes did you make? (Give an overview)
Issue link: #12442
Not sure whether I am the only one, I tends to not read the documentation page by page before the development and hence I neglect the fact that there is an option to have better control on the unit testing.
Also, the documentation in https://eslint.org/docs/developer-guide/unit-tests#running-individual-tests isn't complete as the developer can utilize all options from the mocha cli such as
--watch
.I think it might better to have it in the
package.json
as a script so that it's easier for someone else in the future to find this option easier.Is there anything you'd like reviewers to focus on?
N/A