Skip to content
Myr

output-buffer.js

This file

Path

test/verbose/output-buffer.js

53 lines · 3.1 KiB · JavaScript

Last changed by

TweaksSindre Sorhusbefore adoption698a1b8

History of this file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

TweaksSindre Sorhusbefore adoption698a1b8

lines 1–2why, one step back
1import assert from 'node:assert/strict';
2import test from 'node:test';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 3–4why, one step back
3import {setFixtureDirectory} from '../helpers/fixtures-directory.js';
4import {foobarString, foobarUppercase} from '../helpers/input.js';

Refactor test helpers for the `verbose` option (#1128)ehmickybefore adoption18d320f

line 5why, one step back
5import {nestedSubprocess} from '../helpers/nested.js';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 6–8why, one step back
6import {
7 getOutputLine,8 testTimestamp,

Add more tests for the `verbose` option (#1127)ehmickybefore adoption37e0024

lines 9–11why, one step back
9 stdoutNoneOption,
10 stdoutFullOption,11 stderrFullOption,

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 12–15why, one step back
12} from '../helpers/verbose.js';
1314setFixtureDirectory();15

TweaksSindre Sorhusbefore adoption698a1b8

line 16why, one step back
16const testPrintOutputNoBuffer = async (verbose, buffer, isSync) => {

Refactor test helpers for the `verbose` option (#1128)ehmickybefore adoption18d320f

line 17why, one step back
17 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {verbose, buffer, isSync});

TweaksSindre Sorhusbefore adoption698a1b8

line 18why, one step back
18 assert.equal(getOutputLine(stderr), `${testTimestamp} [0] ${foobarString}`);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 19–20why, one step back
19};
20

TweaksSindre Sorhusbefore adoption698a1b8

lines 21–26why, one step back
21test('Prints stdout, buffer: false', () => testPrintOutputNoBuffer('full', false, false));
22test('Prints stdout, buffer: false, fd-specific buffer', () => testPrintOutputNoBuffer('full', {stdout: false}, false));23test('Prints stdout, buffer: false, fd-specific verbose', () => testPrintOutputNoBuffer(stdoutFullOption, false, false));24test('Prints stdout, buffer: false, sync', () => testPrintOutputNoBuffer('full', false, true));25test('Prints stdout, buffer: false, fd-specific buffer, sync', () => testPrintOutputNoBuffer('full', {stdout: false}, true));26test('Prints stdout, buffer: false, fd-specific verbose, sync', () => testPrintOutputNoBuffer(stdoutFullOption, false, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 27why, one step back
27

TweaksSindre Sorhusbefore adoption698a1b8

line 28why, one step back
28const testPrintOutputNoBufferFalse = async (verbose, buffer, isSync) => {

Refactor test helpers for the `verbose` option (#1128)ehmickybefore adoption18d320f

line 29why, one step back
29 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {verbose, buffer, isSync});

TweaksSindre Sorhusbefore adoption698a1b8

line 30why, one step back
30 assert.equal(getOutputLine(stderr), undefined);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 31–32why, one step back
31};
32

TweaksSindre Sorhusbefore adoption698a1b8

lines 33–38why, one step back
33test('Does not print stdout, buffer: false, fd-specific none', () => testPrintOutputNoBufferFalse(stdoutNoneOption, false, false));
34test('Does not print stdout, buffer: false, different fd', () => testPrintOutputNoBufferFalse(stderrFullOption, false, false));35test('Does not print stdout, buffer: false, different fd, fd-specific buffer', () => testPrintOutputNoBufferFalse(stderrFullOption, {stdout: false}, false));36test('Does not print stdout, buffer: false, fd-specific none, sync', () => testPrintOutputNoBufferFalse(stdoutNoneOption, false, true));37test('Does not print stdout, buffer: false, different fd, sync', () => testPrintOutputNoBufferFalse(stderrFullOption, false, true));38test('Does not print stdout, buffer: false, different fd, fd-specific buffer, sync', () => testPrintOutputNoBufferFalse(stderrFullOption, {stdout: false}, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 39why, one step back
39

TweaksSindre Sorhusbefore adoption698a1b8

line 40why, one step back
40const testPrintOutputNoBufferTransform = async (buffer, isSync) => {

Refactor test helpers for the `verbose` option (#1128)ehmickybefore adoption18d320f

lines 41–42why, one step back
41 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {
42 optionsFixture: 'generator-uppercase.js',

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 43–46why, one step back
43 verbose: 'full',
44 buffer,45 isSync,46 });

TweaksSindre Sorhusbefore adoption698a1b8

line 47why, one step back
47 assert.equal(getOutputLine(stderr), `${testTimestamp} [0] ${foobarUppercase}`);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 48–49why, one step back
48};
49

TweaksSindre Sorhusbefore adoption698a1b8

lines 50–53why, one step back
50test('Prints stdout, buffer: false, transform', () => testPrintOutputNoBufferTransform(false, false));
51test('Prints stdout, buffer: false, transform, fd-specific buffer', () => testPrintOutputNoBufferTransform({stdout: false}, false));52test('Prints stdout, buffer: false, transform, sync', () => testPrintOutputNoBufferTransform(false, true));53test('Prints stdout, buffer: false, transform, fd-specific buffer, sync', () => testPrintOutputNoBufferTransform({stdout: false}, true));