custom-options.js
This file
Path
test/verbose/custom-options.js
48 lines · 3.3 KiB · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
TweaksSindre Sorhusbefore adoption698a1b8
lines 1–2why, one step back1import assert from 'node:assert/strict';2import test from 'node:test';Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 3–7why, one step back3import {setFixtureDirectory} from '../helpers/fixtures-directory.js';4import {runVerboseSubprocess} from '../helpers/verbose.js';56setFixtureDirectory();7TweaksSindre Sorhusbefore adoption698a1b8
line 8why, one step back8const testVerboseOptionsExplicit = async (type, isSync) => {Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 9–16why, one step back9 const maxBuffer = 1000;10 const {stderr} = await runVerboseSubprocess({11 isSync,12 type,13 optionsFixture: 'custom-option.js',14 optionName: 'maxBuffer',15 maxBuffer,16 });TweaksSindre Sorhusbefore adoption698a1b8
line 17why, one step back17 assert.equal(stderr, `${maxBuffer}`);Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 18–19why, one step back18};19TweaksSindre Sorhusbefore adoption698a1b8
lines 20–28why, one step back20test('"verbose" function receives verboseObject.options explicitly set, "command"', () => testVerboseOptionsExplicit('command', false));21test('"verbose" function receives verboseObject.options explicitly set, "output"', () => testVerboseOptionsExplicit('output', false));22test('"verbose" function receives verboseObject.options explicitly set, "ipc"', () => testVerboseOptionsExplicit('ipc', false));23test('"verbose" function receives verboseObject.options explicitly set, "error"', () => testVerboseOptionsExplicit('error', false));24test('"verbose" function receives verboseObject.options explicitly set, "duration"', () => testVerboseOptionsExplicit('duration', false));25test('"verbose" function receives verboseObject.options explicitly set, "command", sync', () => testVerboseOptionsExplicit('command', true));26test('"verbose" function receives verboseObject.options explicitly set, "output", sync', () => testVerboseOptionsExplicit('output', true));27test('"verbose" function receives verboseObject.options explicitly set, "error", sync', () => testVerboseOptionsExplicit('error', true));28test('"verbose" function receives verboseObject.options explicitly set, "duration", sync', () => testVerboseOptionsExplicit('duration', true));Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
line 29why, one step back29TweaksSindre Sorhusbefore adoption698a1b8
line 30why, one step back30const testVerboseOptionsDefault = async (type, isSync) => {Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 31–36why, one step back31 const {stderr} = await runVerboseSubprocess({32 isSync,33 type,34 optionsFixture: 'custom-option.js',35 optionName: 'maxBuffer',36 });TweaksSindre Sorhusbefore adoption698a1b8
line 37why, one step back37 assert.equal(stderr, 'undefined');Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 38–39why, one step back38};39TweaksSindre Sorhusbefore adoption698a1b8
lines 40–48why, one step back40test('"verbose" function receives verboseObject.options before default values and normalization, "command"', () => testVerboseOptionsDefault('command', false));41test('"verbose" function receives verboseObject.options before default values and normalization, "output"', () => testVerboseOptionsDefault('output', false));42test('"verbose" function receives verboseObject.options before default values and normalization, "ipc"', () => testVerboseOptionsDefault('ipc', false));43test('"verbose" function receives verboseObject.options before default values and normalization, "error"', () => testVerboseOptionsDefault('error', false));44test('"verbose" function receives verboseObject.options before default values and normalization, "duration"', () => testVerboseOptionsDefault('duration', false));45test('"verbose" function receives verboseObject.options before default values and normalization, "command", sync', () => testVerboseOptionsDefault('command', true));46test('"verbose" function receives verboseObject.options before default values and normalization, "output", sync', () => testVerboseOptionsDefault('output', true));47test('"verbose" function receives verboseObject.options before default values and normalization, "error", sync', () => testVerboseOptionsDefault('error', true));48test('"verbose" function receives verboseObject.options before default values and normalization, "duration", sync', () => testVerboseOptionsDefault('duration', true));