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
[Feature idea] Execute current package's binary #281
Comments
I tested the |
I feel like this is outside the scope of |
If it's as a separate library, I would imagine it to be restricted to this use case as: const binPath = await getBinPath('binary-name') Like this it could be used outside of import getBinPath from 'get-bin-path'
test('should work', async t => {
const binPath = await getBinPath('binary-name')
const output = await execa(binPath, ['arguments'])
t.is(output, 'expected value')
}) What do you think? I could build that. The only other package that does that seems to be |
👍 We could link to it from the readme. |
Done by #339 |
When
execa
is used in unit tests to test the current package's CLI, it might look like this:To improve this use case, should we allow the following?
It could be implemented like this:
readPkgUp[.sync]()
. This could be cached.bin
field string or objectfile
passed to execa, use the binary path insteadThis would be behind a
currentPackage: boolean
option. We could default it either tofalse
ortrue
.Advantages:
bin
field inpackage.json
is valid. This is something that is basically never checked in unit tests, but should.Is this a good idea?
The text was updated successfully, but these errors were encountered: