From 0056521cd8478abe5d379dbe0d804246677a5840 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Tue, 7 May 2019 11:56:04 +0200 Subject: [PATCH] Improve test for options.preferLocal --- package.json | 1 - test.js | 16 +++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 79eef95572..3ea5a2f49e 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "devDependencies": { "@types/node": "^11.12.2", "ava": "^1.4.1", - "cat-names": "^2.0.0", "coveralls": "^3.0.3", "delay": "^4.1.0", "is-running": "^2.1.0", diff --git a/test.js b/test.js index abbf7d77c8..ba8d635d00 100644 --- a/test.js +++ b/test.js @@ -184,19 +184,9 @@ test('stripFinalNewline option', async t => { t.is(stdout, 'foo\n'); }); -test.serial('preferLocal option', async t => { - t.true((await execa('cat-names')).stdout.length > 2); - - if (process.platform === 'win32') { - // TODO: figure out how to make the below not hang on Windows - return; - } - - // Account for npm adding local binaries to the PATH - const _path = process.env.PATH; - process.env.PATH = ''; - await t.throwsAsync(execa('cat-names', {preferLocal: false}), /spawn .* ENOENT/); - process.env.PATH = _path; +test('preferLocal option', async t => { + await execa('ava', ['--version'], {env: {PATH: ''}}); + await t.throwsAsync(execa('ava', ['--version'], {preferLocal: false, env: {PATH: ''}}), /spawn .* ENOENT/); }); test.serial('localDir option', async t => {