Skip to content
Myr

Fix test for `options.localDir` (#218)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by Sindre Sorhus · parent 3e7ea99 · Browse files · 2 files+7 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−14 removed

  • other:+7 added−14 removed

2 files+7 added−14 removed

deleted:fixtures/local-dir/package.json-5 removed
modified:test.js+7 added-9 removed
188 unmodified lines
189 const errorRegExp = process.platform === 'win32' ? /not recognized/ : /spawn ava ENOENT/;190 await t.throwsAsync(execa('ava', ['--version'], {preferLocal: false, env: {PATH: ''}}), errorRegExp);191});192193test.serial('localDir option', async t => {194 const cwd = 'fixtures/local-dir';195 const bin = path.resolve(cwd, 'node_modules/.bin/self-path');196197 await execa('npm', ['install', '--no-package-lock'], {cwd});198199 const {stdout} = await execa(bin, {localDir: cwd});200201 t.is(path.relative(cwd, stdout), path.normalize('node_modules/self-path'));193test('localDir option', async t => {194 const command = process.platform === 'win32' ? 'echo %PATH%' : 'echo $PATH';195 const {stdout} = await execa(command, {shell: true, localDir: '/test'});196 const envPaths = stdout.split(path.delimiter).map(envPath =>197 envPath.replace(/\\/g, '/').replace(/^[^/]+/, '')198 );199 t.true(envPaths.some(envPath => envPath === '/test/node_modules/.bin'));200});201202test('input option can be a String', async t => {203 const {stdout} = await execa('stdin', {input: 'foobar'});
477 unmodified lines