Skip to content

Commit

Permalink
Fix regression in v3 when not passing an object
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
sindresorhus committed Mar 23, 2019
1 parent f62a81e commit 10908be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const findUp = require('find-up');

module.exports = async ({cwd}) => findUp('package.json', {cwd});
module.exports.sync = ({cwd}) => findUp.sync('package.json', {cwd});
module.exports = async ({cwd} = {}) => findUp('package.json', {cwd});
module.exports.sync = ({cwd} = {}) => findUp.sync('package.json', {cwd});
2 changes: 2 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ const pkgPath = path.join(__dirname, 'package.json');

test('async', async t => {
t.is(await pkgUp({cwd}), pkgPath);
t.is(path.dirname(await pkgUp()), __dirname);
});

test('sync', t => {
t.is(pkgUp.sync({cwd}), pkgPath);
t.is(path.dirname(pkgUp.sync()), __dirname);
});

0 comments on commit 10908be

Please sign in to comment.