diff --git a/src/cli/bin.js b/src/cli/bin.js index f22530c10e..fc6c009365 100755 --- a/src/cli/bin.js +++ b/src/cli/bin.js @@ -6,7 +6,7 @@ const yargs = require('yargs') const updateNotifier = require('update-notifier') const readPkgUp = require('read-pkg-up') -const pkg = readPkgUp.sync().pkg +const pkg = readPkgUp.sync({cwd: __dirname}).pkg updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week diff --git a/test/cli/test-commands.js b/test/cli/test-commands.js index ca3492e00a..3e24ad2ffb 100644 --- a/test/cli/test-commands.js +++ b/test/cli/test-commands.js @@ -14,4 +14,13 @@ describe('commands', () => { done() }) }) + it('list the commands even if not in the same dir', (done) => { + nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'commands'], {cwd: '/tmp'}) + .run((err, stdout, exitcode) => { + expect(err).to.not.exist + expect(exitcode).to.equal(0) + expect(stdout.length).to.equal(56) + done() + }) + }) })