-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add tests for running from command line #492
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,3 @@ | |||
{ | |||
"name": "missing-translations" |
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.
When running the bin/cli
script from a fixture, the let rootDir = pkgDir.sync();
line would return the root of this whole repo, because there is no package.json
in fixtures. Adding it with just a name fixed this.
@@ -34,6 +34,7 @@ | |||
"eslint-config-prettier": "8.5.0", | |||
"eslint-plugin-node": "11.1.0", | |||
"eslint-plugin-prettier": "4.0.0", | |||
"execa": "^5.0.0", |
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 dependency actually came with Jest
already, hence no changes in yarn.lock
. Also note that version 6.x doesn't work here, because of the same reason that require
ing it doesn't work then.
afterEach(async function () { | ||
await execa('git', ['checkout', 'HEAD', 'fixtures/remove-unused-translations/translations'], { | ||
cwd: __dirname, | ||
}); |
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.
The auto-fix option actually changes the files, so this makes sure those changes are undone. It does feel a bit specific though, so any other ideas are welcome :)
After the
pkg-dir
upgrade in #427 thebin/cli
command failed, but this was not caught because there were no tests for it, so I added that with this PR.About the tests themselves: I'm not 100% sure if this is the way to go, but these are at least simple tests that showed that the command was broken before the downgrade fixed it. I'm happy to get any feedback on how to improve this.