Skip to content
Myr

output-mixed.js

This file

Path

test/verbose/output-mixed.js

86 lines · 3.5 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 {inspect} from 'node:util';

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 {setFixtureDirectory} from '../helpers/fixtures-directory.js';
5import {foobarString, foobarObject} from '../helpers/input.js';6import {simpleFull, noNewlinesChunks} from '../helpers/lines.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, getOutputLines, testTimestamp} from '../helpers/verbose.js';
910setFixtureDirectory();11

TweaksSindre Sorhusbefore adoption698a1b8

line 12why, one step back
12const testLines = async (lines, stripFinalNewline, isSync) => {

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

lines 13–18why, one step back
13 const {stderr} = await nestedSubprocess('noop-fd.js', ['1', simpleFull], {
14 verbose: 'full',15 lines,16 stripFinalNewline,17 isSync,18 });

TweaksSindre Sorhusbefore adoption698a1b8

line 19why, one step back
19 assert.deepEqual(getOutputLines(stderr), noNewlinesChunks.map(line => `${testTimestamp} [0] ${line}`));

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

TweaksSindre Sorhusbefore adoption698a1b8

lines 22–27why, one step back
22test('Prints stdout, "lines: true"', () => testLines(true, false, false));
23test('Prints stdout, "lines: true", fd-specific', () => testLines({stdout: true}, false, false));24test('Prints stdout, "lines: true", stripFinalNewline', () => testLines(true, true, false));25test('Prints stdout, "lines: true", sync', () => testLines(true, false, true));26test('Prints stdout, "lines: true", fd-specific, sync', () => testLines({stdout: true}, false, true));27test('Prints stdout, "lines: true", stripFinalNewline, sync', () => testLines(true, true, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 28why, one step back
28

TweaksSindre Sorhusbefore adoption698a1b8

line 29why, one step back
29const testOnlyTransforms = async isSync => {

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

lines 30–34why, one step back
30 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {
31 optionsFixture: 'generator-uppercase.js',32 verbose: 'full',33 isSync,34 });

TweaksSindre Sorhusbefore adoption698a1b8

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 36–37why, one step back
36};
37

TweaksSindre Sorhusbefore adoption698a1b8

lines 38–39why, one step back
38test('Prints stdout with only transforms', () => testOnlyTransforms(false));
39test('Prints stdout with only transforms, sync', () => testOnlyTransforms(true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 40why, one step back
40

TweaksSindre Sorhusbefore adoption698a1b8

line 41why, one step back
41test('Prints stdout with only duplexes', async () => {

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

lines 42–45why, one step back
42 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {
43 optionsFixture: 'generator-duplex.js',44 verbose: 'full',45 });

TweaksSindre Sorhusbefore adoption698a1b8

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

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

lines 47–48why, one step back
47});
48

TweaksSindre Sorhusbefore adoption698a1b8

line 49why, one step back
49const testObjectMode = async isSync => {

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

lines 50–54why, one step back
50 const {stderr} = await nestedSubprocess('noop.js', {
51 optionsFixture: 'generator-object.js',52 verbose: 'full',53 isSync,54 });

TweaksSindre Sorhusbefore adoption698a1b8

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 56–57why, one step back
56};
57

TweaksSindre Sorhusbefore adoption698a1b8

lines 58–59why, one step back
58test('Prints stdout with object transforms', () => testObjectMode(false));
59test('Prints stdout with object transforms, sync', () => testObjectMode(true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 60why, one step back
60

TweaksSindre Sorhusbefore adoption698a1b8

line 61why, one step back
61const testBigArray = async isSync => {

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

lines 62–66why, one step back
62 const {stderr} = await nestedSubprocess('noop.js', {
63 optionsFixture: 'generator-big-array.js',64 verbose: 'full',65 isSync,66 });

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 67why, one step back
67 const lines = getOutputLines(stderr);

TweaksSindre Sorhusbefore adoption698a1b8

lines 68–70why, one step back
68 assert.equal(lines[0], `${testTimestamp} [0] [`);
69 assert.ok(lines[1].startsWith(`${testTimestamp} [0] 0, 1,`));70 assert.equal(lines.at(-1), `${testTimestamp} [0] ]`);

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

TweaksSindre Sorhusbefore adoption698a1b8

lines 73–74why, one step back
73test('Prints stdout with big object transforms', () => testBigArray(false));
74test('Prints stdout with big object transforms, sync', () => testBigArray(true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 75why, one step back
75

TweaksSindre Sorhusbefore adoption698a1b8

line 76why, one step back
76const testObjectModeString = async isSync => {

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

lines 77–81why, one step back
77 const {stderr} = await nestedSubprocess('noop.js', {
78 optionsFixture: 'generator-string-object.js',79 verbose: 'full',80 isSync,81 });

TweaksSindre Sorhusbefore adoption698a1b8

line 82why, one step back
82 assert.deepEqual(getOutputLines(stderr), noNewlinesChunks.map(line => `${testTimestamp} [0] ${line}`));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 83–84why, one step back
83};
84

TweaksSindre Sorhusbefore adoption698a1b8

lines 85–86why, one step back
85test('Prints stdout with string transforms in objectMode', () => testObjectModeString(false));
86test('Prints stdout with string transforms in objectMode, sync', () => testObjectModeString(true));