Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 9afd69b

Browse files
authored
Merge pull request #503 from VictorBjelkholm/fix-497
fix(cli): Fix issue with right cwd not being set
2 parents 5d82ee3 + e5f5e1b commit 9afd69b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/cli/bin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const yargs = require('yargs')
66
const updateNotifier = require('update-notifier')
77
const readPkgUp = require('read-pkg-up')
88

9-
const pkg = readPkgUp.sync().pkg
9+
const pkg = readPkgUp.sync({cwd: __dirname}).pkg
1010
updateNotifier({
1111
pkg,
1212
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week

test/cli/test-commands.js

+9
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ describe('commands', () => {
1414
done()
1515
})
1616
})
17+
it('list the commands even if not in the same dir', (done) => {
18+
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'commands'], {cwd: '/tmp'})
19+
.run((err, stdout, exitcode) => {
20+
expect(err).to.not.exist
21+
expect(exitcode).to.equal(0)
22+
expect(stdout.length).to.equal(56)
23+
done()
24+
})
25+
})
1726
})

0 commit comments

Comments
 (0)