Skip to content
Myr

output-noop.js

This file

Path

test/verbose/output-noop.js

79 lines · 4.6 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

line 1why, one step back
1import assert from 'node:assert/strict';

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 2why, one step back
2import {rm, readFile} from 'node:fs/promises';

TweaksSindre Sorhusbefore adoption698a1b8

line 3why, one step back
3import test from 'node:test';

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

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

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 8–11why, one step back
8import {getOutputLine, testTimestamp} from '../helpers/verbose.js';
910setFixtureDirectory();11

TweaksSindre Sorhusbefore adoption698a1b8

line 12why, one step back
12const testNoOutputOptions = async (isSync, options) => {

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

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

TweaksSindre Sorhusbefore adoption698a1b8

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 15–16why, one step back
15};
16

TweaksSindre Sorhusbefore adoption698a1b8

lines 17–28why, one step back
17test('Does not print stdout, encoding "buffer"', () => testNoOutputOptions(false, {encoding: 'buffer'}));
18test('Does not print stdout, encoding "hex"', () => testNoOutputOptions(false, {encoding: 'hex'}));19test('Does not print stdout, encoding "base64"', () => testNoOutputOptions(false, {encoding: 'base64'}));20test('Does not print stdout, stdout "ignore"', () => testNoOutputOptions(false, {stdout: 'ignore'}));21test('Does not print stdout, stdout "inherit"', () => testNoOutputOptions(false, {stdout: 'inherit'}));22test('Does not print stdout, stdout 1', () => testNoOutputOptions(false, {stdout: 1}));23test('Does not print stdout, encoding "buffer", sync', () => testNoOutputOptions(true, {encoding: 'buffer'}));24test('Does not print stdout, encoding "hex", sync', () => testNoOutputOptions(true, {encoding: 'hex'}));25test('Does not print stdout, encoding "base64", sync', () => testNoOutputOptions(true, {encoding: 'base64'}));26test('Does not print stdout, stdout "ignore", sync', () => testNoOutputOptions(true, {stdout: 'ignore'}));27test('Does not print stdout, stdout "inherit", sync', () => testNoOutputOptions(true, {stdout: 'inherit'}));28test('Does not print stdout, stdout 1, sync', () => testNoOutputOptions(true, {stdout: 1}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 29why, one step back
29

TweaksSindre Sorhusbefore adoption698a1b8

line 30why, one step back
30const testNoOutputDynamic = async (isSync, optionsFixture) => {

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

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

TweaksSindre Sorhusbefore adoption698a1b8

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

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

lines 33–34why, one step back
33};
34

TweaksSindre Sorhusbefore adoption698a1b8

lines 35–38why, one step back
35test('Does not print stdout, stdout Writable', () => testNoOutputDynamic(false, 'writable.js'));
36test('Does not print stdout, stdout WritableStream', () => testNoOutputDynamic(false, 'writable-web.js'));37test('Does not print stdout, stdout Writable, sync', () => testNoOutputDynamic(true, 'writable.js'));38test('Does not print stdout, stdout WritableStream, sync', () => testNoOutputDynamic(true, 'writable-web.js'));

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

line 39why, one step back
39

TweaksSindre Sorhusbefore adoption698a1b8

line 40why, one step back
40const testNoOutputStream = async parentFixture => {

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

line 41why, one step back
41 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {verbose: 'full', parentFixture});

TweaksSindre Sorhusbefore adoption698a1b8

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

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

lines 43–44why, one step back
43};
44

TweaksSindre Sorhusbefore adoption698a1b8

lines 45–47why, one step back
45test('Does not print stdout, .pipe(stream)', () => testNoOutputStream('nested-pipe-stream.js'));
46test('Does not print stdout, .pipe(subprocess)', () => testNoOutputStream('nested-pipe-subprocess.js'));47test('Does not print stdout, subprocess.all.pipe(stream)', () => testNoOutputStream('nested-pipe-all-stream.js'));

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

line 48why, one step back
48

TweaksSindre Sorhusbefore adoption698a1b8

line 49why, one step back
49const testStdoutFile = async (isSync, optionsFixture) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 50why, one step back
50 const file = tempfile();

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

lines 51–56why, one step back
51 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {
52 verbose: 'full',53 stdout: {file},54 isSync,55 optionsFixture,56 });

TweaksSindre Sorhusbefore adoption698a1b8

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 58why, one step back
58 const contents = await readFile(file, 'utf8');

TweaksSindre Sorhusbefore adoption698a1b8

line 59why, one step back
59 assert.equal(contents.trim(), foobarString);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 60–62why, one step back
60 await rm(file);
61};62

TweaksSindre Sorhusbefore adoption698a1b8

lines 63–66why, one step back
63test('Does not print stdout, stdout { file }', () => testStdoutFile(false));
64test('Does not print stdout, stdout fileUrl', () => testStdoutFile(false, 'file-url.js'));65test('Does not print stdout, stdout { file }, sync', () => testStdoutFile(true));66test('Does not print stdout, stdout fileUrl, sync', () => testStdoutFile(true, 'file-url.js'));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 67why, one step back
67

TweaksSindre Sorhusbefore adoption698a1b8

line 68why, one step back
68const testPrintOutputOptions = async (options, isSync) => {

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

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

TweaksSindre Sorhusbefore adoption698a1b8

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 71–72why, one step back
71};
72

TweaksSindre Sorhusbefore adoption698a1b8

lines 73–79why, one step back
73test('Prints stdout, stdout "pipe"', () => testPrintOutputOptions({stdout: 'pipe'}, false));
74test('Prints stdout, stdout "overlapped"', () => testPrintOutputOptions({stdout: 'overlapped'}, false));75test('Prints stdout, stdout null', () => testPrintOutputOptions({stdout: null}, false));76test('Prints stdout, stdout ["pipe"]', () => testPrintOutputOptions({stdout: ['pipe']}, false));77test('Prints stdout, stdout "pipe", sync', () => testPrintOutputOptions({stdout: 'pipe'}, true));78test('Prints stdout, stdout null, sync', () => testPrintOutputOptions({stdout: null}, true));79test('Prints stdout, stdout ["pipe"], sync', () => testPrintOutputOptions({stdout: ['pipe']}, true));