How to use the execa.stderr function in execa

To help you get started, we’ve selected a few execa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / execa_v0.10.x / test_execa.js View on Github external
execa(['ls', '-l']).then(printStdout);
// $ExpectError
execa('ls').then(printErrno);

(execa.stdout('ls'): Promise);
execa.stdout('ls').then(stdout => stdout.toLowerCase());
execa.stdout('ls', ['-l']).then(stdout => stdout.toLowerCase());
execa.stdout('ls', { uid: 1000, gid: 100 }).then(stdout => stdout.toLowerCase());
execa.stdout('ls', ['-l'], { timeout: 5 }).then(stdout => stdout.toLowerCase());
// $ExpectError
execa.stdout(['ls', '-l']);
// $ExpectError
execa.stdout('ls', { foo: 666 });

(execa.stderr('ls'): Promise);
execa.stderr('ls').then(stdout => stdout.toLowerCase());
execa.stderr('ls', ['-l']).then(stdout => stdout.toLowerCase());
execa.stderr('ls', { uid: 1000, gid: 100 }).then(stdout => stdout.toLowerCase());
execa.stderr('ls', ['-l'], { timeout: 5 }).then(stdout => stdout.toLowerCase());
// $ExpectError
execa.stderr(['ls', '-l']);
// $ExpectError
execa.stderr('ls', { foo: 666 });

(execa.shell('ls | wc -l'): ThenableChildProcess);
execa.shell('ls | wc -l').then(printStdout, printErrno);
execa.shell('ls | wc -l', { cwd: '/' }).then(printStdout);
execa.shell('foo').catch(printErrno);
// $ExpectError
execa.shell(['ls', 'wc -l']);
// $ExpectError
execa.stderr('ls', 'wc -l', { foo: 666 });
github flow-typed / flow-typed / definitions / npm / execa_v0.10.x / test_execa.js View on Github external
execa.shell('ls | wc -l').then(printStdout, printErrno);
execa.shell('ls | wc -l', { cwd: '/' }).then(printStdout);
execa.shell('foo').catch(printErrno);
// $ExpectError
execa.shell(['ls', 'wc -l']);
// $ExpectError
execa.stderr('ls', 'wc -l', { foo: 666 });

(execa.sync('ls'): SyncResult);
(execa.sync('ls', ['-l']).stdout: string);
(execa.sync('ls', { stderr: 'pipe' }).signal: ?string);
(execa.sync('ls', ['-l'], { localDir: '~/' }).failed: boolean);
// $ExpectError
execa.sync(['ls']);
// $ExpectError
execa.stderr('ls', { foo: 666 });
// $ExpectError
execa.sync('ls').killed;
// $ExpectError
execa.sync('ls', { input: process.stdin });

(execa.shellSync('ls | wc -l'): SyncResult);
(execa.shellSync('ls | wc -l', { stderr: 'ignore' }).stdout: string);
// $ExpectError
execa.shellSync(['ls', 'wc -l']);
// $ExpectError
execa.shellSync('ls', { foo: 666 });

async () => {
  const { stdout } = await execa('noop', ['foo'], { stripEof: false });
};
github flow-typed / flow-typed / definitions / npm / execa_v0.10.x / test_execa.js View on Github external
execa.stdout('ls').then(stdout => stdout.toLowerCase());
execa.stdout('ls', ['-l']).then(stdout => stdout.toLowerCase());
execa.stdout('ls', { uid: 1000, gid: 100 }).then(stdout => stdout.toLowerCase());
execa.stdout('ls', ['-l'], { timeout: 5 }).then(stdout => stdout.toLowerCase());
// $ExpectError
execa.stdout(['ls', '-l']);
// $ExpectError
execa.stdout('ls', { foo: 666 });

(execa.stderr('ls'): Promise);
execa.stderr('ls').then(stdout => stdout.toLowerCase());
execa.stderr('ls', ['-l']).then(stdout => stdout.toLowerCase());
execa.stderr('ls', { uid: 1000, gid: 100 }).then(stdout => stdout.toLowerCase());
execa.stderr('ls', ['-l'], { timeout: 5 }).then(stdout => stdout.toLowerCase());
// $ExpectError
execa.stderr(['ls', '-l']);
// $ExpectError
execa.stderr('ls', { foo: 666 });

(execa.shell('ls | wc -l'): ThenableChildProcess);
execa.shell('ls | wc -l').then(printStdout, printErrno);
execa.shell('ls | wc -l', { cwd: '/' }).then(printStdout);
execa.shell('foo').catch(printErrno);
// $ExpectError
execa.shell(['ls', 'wc -l']);
// $ExpectError
execa.stderr('ls', 'wc -l', { foo: 666 });

(execa.sync('ls'): SyncResult);
(execa.sync('ls', ['-l']).stdout: string);
(execa.sync('ls', { stderr: 'pipe' }).signal: ?string);
(execa.sync('ls', ['-l'], { localDir: '~/' }).failed: boolean);
github flow-typed / flow-typed / definitions / npm / execa_v0.10.x / test_execa.js View on Github external
execa.stderr('ls', ['-l']).then(stdout => stdout.toLowerCase());
execa.stderr('ls', { uid: 1000, gid: 100 }).then(stdout => stdout.toLowerCase());
execa.stderr('ls', ['-l'], { timeout: 5 }).then(stdout => stdout.toLowerCase());
// $ExpectError
execa.stderr(['ls', '-l']);
// $ExpectError
execa.stderr('ls', { foo: 666 });

(execa.shell('ls | wc -l'): ThenableChildProcess);
execa.shell('ls | wc -l').then(printStdout, printErrno);
execa.shell('ls | wc -l', { cwd: '/' }).then(printStdout);
execa.shell('foo').catch(printErrno);
// $ExpectError
execa.shell(['ls', 'wc -l']);
// $ExpectError
execa.stderr('ls', 'wc -l', { foo: 666 });

(execa.sync('ls'): SyncResult);
(execa.sync('ls', ['-l']).stdout: string);
(execa.sync('ls', { stderr: 'pipe' }).signal: ?string);
(execa.sync('ls', ['-l'], { localDir: '~/' }).failed: boolean);
// $ExpectError
execa.sync(['ls']);
// $ExpectError
execa.stderr('ls', { foo: 666 });
// $ExpectError
execa.sync('ls').killed;
// $ExpectError
execa.sync('ls', { input: process.stdin });

(execa.shellSync('ls | wc -l'): SyncResult);
(execa.shellSync('ls | wc -l', { stderr: 'ignore' }).stdout: string);
github sindresorhus / awesome-lint / test / cli.js View on Github external
test('main - invalid GitHub repository', async t => {
	await t.throwsAsync(
		execa.stderr('./cli.js', ['https://github.com/sindresorhus/awesome-lint/blob/master/readme.md']),
		/Invalid GitHub repo URL/
	);
});
github DefinitelyTyped / DefinitelyTyped / types / execa / execa-tests.ts View on Github external
assert(error.killed === false);
        assert(error.signal === 'SIGINT');
        assert(error.stderr === 'stderr');
        assert(error.stdout === 'stdout');
        assert(error.timedOut === false);
    });

execa('noop', ['foo'])
    .then(result => result.stderr.toLocaleLowerCase());

execa.stdout('unicorns')
    .then(stdout => stdout.toLocaleLowerCase());
execa.stdout('echo', ['unicorns'])
    .then(stdout => stdout.toLocaleLowerCase());

execa.stderr('unicorns')
    .then(stderr => stderr.toLocaleLowerCase());
execa.stderr('echo', ['unicorns'])
    .then(stderr => stderr.toLocaleLowerCase());

execa.shell('echo unicorns')
    .then(result => result.stdout.toLocaleLowerCase());

{
    let result: string;
    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop', { cwd: 'foo' }).stdout;

    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop foo').stdout;
}
github DefinitelyTyped / DefinitelyTyped / types / execa / execa-tests.ts View on Github external
assert(error.stderr === 'stderr');
        assert(error.stdout === 'stdout');
        assert(error.timedOut === false);
    });

execa('noop', ['foo'])
    .then(result => result.stderr.toLocaleLowerCase());

execa.stdout('unicorns')
    .then(stdout => stdout.toLocaleLowerCase());
execa.stdout('echo', ['unicorns'])
    .then(stdout => stdout.toLocaleLowerCase());

execa.stderr('unicorns')
    .then(stderr => stderr.toLocaleLowerCase());
execa.stderr('echo', ['unicorns'])
    .then(stderr => stderr.toLocaleLowerCase());

execa.shell('echo unicorns')
    .then(result => result.stdout.toLocaleLowerCase());

{
    let result: string;
    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop', { cwd: 'foo' }).stdout;

    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop foo').stdout;
}

execa('echo', ['unicorns']).stdout.pipe(process.stdout);
execa('echo', ['unicorns']).stderr.pipe(process.stderr);
github elastic / kibana / tasks / function_test_groups.js View on Github external
async function () {
    const done = this.async();

    try {
      const stats = JSON.parse(await execa.stderr(process.execPath, [
        'scripts/functional_test_runner',
        ...TEST_TAGS.map(tag => `--include-tag=${tag}`),
        '--config', 'test/functional/config.js',
        '--test-stats'
      ]));

      if (stats.excludedTests.length > 0) {
        grunt.fail.fatal(`
          ${stats.excludedTests.length} tests are excluded by the ciGroup tags, make sure that
          all test suites have a "ciGroup{X}" tag and that "tasks/functional_test_groups.js"
          knows about the tag that you are using.

          tags: ${JSON.stringify({ include: TEST_TAGS })}

          - ${stats.excludedTests.join('\n          - ')}
        `);