Skip to content

Commit

Permalink
Add test for #73
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 9, 2017
1 parent 0f8f7a3 commit c7481f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fixtures/local-dir/package.json
@@ -0,0 +1,5 @@
{
"dependencies": {
"self-path": "^1.0.0"
}
}
11 changes: 11 additions & 0 deletions test.js
Expand Up @@ -129,6 +129,17 @@ test.serial('preferLocal option', async t => {
process.env.PATH = _path;
});

test('localDir option', async t => {
const cwd = 'fixtures/local-dir';
const bin = path.resolve(cwd, 'node_modules/.bin/self-path');

await m('npm', ['install', '--no-package-lock'], {cwd});

const {stdout} = await m(bin, {localDir: cwd});

t.is(path.relative(cwd, stdout), 'node_modules/self-path');
});

test('input option can be a String', async t => {
const {stdout} = await m('stdin', {input: 'foobar'});
t.is(stdout, 'foobar');
Expand Down

0 comments on commit c7481f4

Please sign in to comment.