Skip to content
Myr

Improve test for `options.preferLocal` (#216)

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 51b1cef · Browse files · 2 files+4 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+4 added−14 removed

  • other:+4 added−14 removed

2 files+4 added−14 removed

modified:package.json-1 removed
modified:test.js+4 added-13 removed
182 unmodified lines
183 const {stdout} = await execa('noop', ['foo'], {stripFinalNewline: false});184 t.is(stdout, 'foo\n');185});186187test.serial('preferLocal option', async t => {188 t.true((await execa('cat-names')).stdout.length > 2);189190 if (process.platform === 'win32') {191 // TODO: figure out how to make the below not hang on Windows192 return;193 }194195 // Account for npm adding local binaries to the PATH196 const _path = process.env.PATH;197 process.env.PATH = '';198 await t.throwsAsync(execa('cat-names', {preferLocal: false}), /spawn .* ENOENT/);199 process.env.PATH = _path;187test('preferLocal option', async t => {188 await execa('ava', ['--version'], {env: {PATH: ''}});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';
494 unmodified lines