Skip to content

Commit

Permalink
🐛 Fix cwd in getPackagePublishedInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumolari committed Dec 12, 2019
1 parent 1a87a24 commit 7c1405e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function getPackagePublishedInfo (cwd: string): Promise<string> {
const pathToPackageJson = await module.exports.findPackageJsonFile(cwd)
const packageName = await module.exports.getPackageName(cwd)

return module.exports.runShellScript(`yarn info '${packageName}' --json`, pathToPackageJson)
return module.exports.runShellScript(`yarn info '${packageName}' --json`, path.dirname(pathToPackageJson))
}

async function findPackageJsonFile (cwd: string): Promise<string> {
Expand Down
4 changes: 2 additions & 2 deletions test/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ describe('Utils', function () {

describe('#getPackagePublishedInfo', function () {
it('Should return run yarn info with proper package name', async function () {
sandbox.stub(utils, 'findPackageJsonFile').resolves('my path')
sandbox.stub(utils, 'findPackageJsonFile').resolves('my-path/package.json')
sandbox.stub(utils, 'getPackageName').resolves('my name')
sandbox.stub(utils, 'runShellScript').resolves('my response')

await expect(utils.getPackagePublishedInfo('')).to.eventually.equal('my response')

expect(utils.runShellScript).to.have.been.calledOnceWithExactly('yarn info \'my name\' --json', 'my path')
expect(utils.runShellScript).to.have.been.calledOnceWithExactly('yarn info \'my name\' --json', 'my-path')
})
})

Expand Down

0 comments on commit 7c1405e

Please sign in to comment.