Fix linting (#77)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sam Verschueren · committed by Sindre Sorhus · parent f2d80c6 · Browse files · 3 files·+11 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+11 added−11 removed
- tests:+2 added−2 removed
- other:+9 added−9 removed
Provenance
- Commit
80a059d- Tree
3a93c63- Author
Sam Verschueren <sam.verschueren@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
f2d80c6
3 files changed+11 added−11 removed
modified:lib/errname.js+2 added-2 removed
10 unmodified lines1112131415151617181912 unmodified lines3233343536363710 unmodified linestry { uv = process.binding('uv');
if (typeof uv.errname !== 'function') { throw new Error('uv.errname is not a function'); throw new TypeError('uv.errname is not a function'); }} catch (err) { console.error('execa/lib/errname: unable to establish process.binding(\'uv\')', err); uv = null;12 unmodified lines}
module.exports = code => errname(uv, code);
// used for testing the fallback behavior// Used for testing the fallback behaviormodule.exports.__test__ = errname;modified:test/errname.js+2 added-2 removed
12345667891011111213141512 unmodified linesimport test from 'ava';import errname from '../lib/errname';
const isWin = process.platform === 'win32';
// simulates failure to capture `process.binding('uv');`// Simulates failure to capture `process.binding('uv');`const fallback = code => errname.__test__(null, code);
function makeTests(name, m, expected) { test(`${name}: >=0 exit codes`, t => { // throws >= 0 // Throws >= 0 t.throws(() => m(0), /err >= 0/); t.throws(() => m(1), /err >= 0/); t.throws(() => m('2'), /err >= 0/); t.throws(() => m('foo'), /err >= 0/);12 unmodified linesmodified:test.js+7 added-7 removed
77 unmodified lines78 // TODO: figure out how to make the below not hang on Windows79 return;80 }81 82- // account for npm adding local binaries to the PATH82+ // Account for npm adding local binaries to the PATH83 const _path = process.env.PATH;84 process.env.PATH = '';85 await t.throws(m('cat-names', {preferLocal: false}), /spawn .* ENOENT/);86 process.env.PATH = _path;22 unmodified lines109 child.stdin.end('unicorns');110 t.is((await child).stdout, 'unicorns');111 });112 113-test('input option can be a String - sync', async t => {113+test('input option can be a String - sync', t => {114 const {stdout} = m.sync('stdin', {input: 'foobar'});115 t.is(stdout, 'foobar');116 });117 118-test('input option can be a Buffer - sync', async t => {119- const {stdout} = m.sync('stdin', {input: new Buffer('testing12', 'utf8')});118+test('input option can be a Buffer - sync', t => {119+ const {stdout} = m.sync('stdin', {input: Buffer.from('testing12', 'utf8')});120 t.is(stdout, 'testing12');121 });122 123 test('opts.stdout:ignore - stdout will not collect data', async t => {224 unmodified lines348 test('cleanup false - SIGINT', spawnAndKill, 'SIGTERM', false);349 test('cleanup false - SIGKILL', spawnAndKill, 'SIGKILL', false);350 }351 352-// see: https://github.com/sindresorhus/execa/issues/56352+// See: https://github.com/sindresorhus/execa/issues/56353 const onlyWinFailing = test[process.platform === 'win32' ? 'failing' : 'serial'];354 onlyWinFailing('execa.shell() supports the `shell` option', async t => {355 const {stdout} = await m.shell('noop foo', {356 shell: process.platform === 'win32' ? 'cmd.exe' : '/bin/bash'2 unmodified lines359 });360 361 if (process.platform !== 'win32') {362 test('write to fast-exit process', async t => {363- // try-catch here is necessary, because this test is not 100% accurate364- // sometimes process can manage to accept input before exiting363+ // Try-catch here is necessary, because this test is not 100% accurate364+ // Sometimes process can manage to accept input before exiting365 try {366 await m(`fast-exit-${process.platform}`, [], {input: 'data'});367 } catch (err) {368 t.is(err.code, 'EPIPE');3 unmodified lines