-
Notifications
You must be signed in to change notification settings - Fork 85
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
Jest Command Based on Project #86
Comments
Although not exactly what you are looking for, but you could use ni to automatically use the correct package manager. For example running ‘nr test —‘ will run your test regardless of your package manager. |
Thanks, but was hoping to not have another toolchain. I might go with this but hoping for another solution |
Not sure if this is still relevant but the jestCommand = function(path)
local cwd = vim.fn.getcwd()
if vim.endswith(cwd, 'my-special-project') then
return "yarn test"
end
return "npm test"
end You might also be able to adapt some of the code for |
@MisanthropicBit interesting. Maybe I could check for lock file. |
tried to alter @MisanthropicBit approach to accept an input as the jest command to run: jestCommand = function(_)
return vim.ui.input({
prompt = 'Enter jest command (default: test): ',
default = 'test',
}, function(input)
return string.format('npm run %s --', input or 'test')
end)
end, but got an error before prompt shows that prevents tests from running, could someone assist?
|
@orenherman Slightly off-topic for the issue but if you read the documentation for You can either use Hope that helps. |
Not an issue per-say but wondering how people configure their jest command when you have projects that use npm, some that use yarn, etc... Do you change your config? Or is there a dynamic way?
Update 1:
I think when I made this ticket, I was bad in not adding a thought on a solution. What if we do something like not pass
jestCommand
and have another property that is something like:With this, what the plugin can do is check in the root dir of project, is there a package-lock, or yarn.lock, or pnpm-lock? Then it could build the
jestCommand
from thatThe text was updated successfully, but these errors were encountered: