Skip to content

Commit

Permalink
fix: resolve folder that is passed in
Browse files Browse the repository at this point in the history
Root cause of npm/cli#613
  • Loading branch information
isaacs committed Dec 26, 2019
1 parent f315830 commit 0bbd303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = BB.promisify(binLinks)

function binLinks (pkg, folder, global, opts, cb) {
pkg = normalize(pkg)
folder = path.resolve(folder)

// if it's global, and folder is in {prefix}/node_modules,
// then bins are in {prefix}/bin
Expand Down
5 changes: 4 additions & 1 deletion test/link-bins.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ t.test('foo package cannot link, pre-existing stuff there', t => {
})

t.test('foo package can link with --force link', t => {
const foo = resolve(me, 'node_modules/foo')
const cwd = process.cwd()
t.teardown(() => process.chdir(cwd))
process.chdir(me)
const foo = 'node_modules/foo'
mkdirp(foo)
const pkg = {
name: 'foo',
Expand Down

0 comments on commit 0bbd303

Please sign in to comment.