custom-id.js
This file
Path
test/verbose/custom-id.js
36 lines · 2.8 KiB · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637import assert from 'node:assert/strict';import test from 'node:test';import {setFixtureDirectory} from '../helpers/fixtures-directory.js';import {QUOTE, runVerboseSubprocess} from '../helpers/verbose.js';
setFixtureDirectory();
const testVerboseCommandId = async (type, isSync) => { const {stderr} = await runVerboseSubprocess({isSync, type, eventProperty: 'commandId'}); assert.equal(stderr, '0');};
test('"verbose" function receives verboseObject.commandId, "command"', () => testVerboseCommandId('command', false));test('"verbose" function receives verboseObject.commandId, "output"', () => testVerboseCommandId('output', false));test('"verbose" function receives verboseObject.commandId, "ipc"', () => testVerboseCommandId('ipc', false));test('"verbose" function receives verboseObject.commandId, "error"', () => testVerboseCommandId('error', false));test('"verbose" function receives verboseObject.commandId, "duration"', () => testVerboseCommandId('duration', false));test('"verbose" function receives verboseObject.commandId, "command", sync', () => testVerboseCommandId('command', true));test('"verbose" function receives verboseObject.commandId, "output", sync', () => testVerboseCommandId('output', true));test('"verbose" function receives verboseObject.commandId, "error", sync', () => testVerboseCommandId('error', true));test('"verbose" function receives verboseObject.commandId, "duration", sync', () => testVerboseCommandId('duration', true));
const testVerboseEscapedCommand = async (type, isSync) => { const {stderr} = await runVerboseSubprocess({isSync, type, eventProperty: 'escapedCommand'}); assert.equal(stderr, `noop-verbose.js ${QUOTE}. .${QUOTE}`);};
test('"verbose" function receives verboseObject.escapedCommand, "command"', () => testVerboseEscapedCommand('command', false));test('"verbose" function receives verboseObject.escapedCommand, "output"', () => testVerboseEscapedCommand('output', false));test('"verbose" function receives verboseObject.escapedCommand, "ipc"', () => testVerboseEscapedCommand('ipc', false));test('"verbose" function receives verboseObject.escapedCommand, "error"', () => testVerboseEscapedCommand('error', false));test('"verbose" function receives verboseObject.escapedCommand, "duration"', () => testVerboseEscapedCommand('duration', false));test('"verbose" function receives verboseObject.escapedCommand, "command", sync', () => testVerboseEscapedCommand('command', true));test('"verbose" function receives verboseObject.escapedCommand, "output", sync', () => testVerboseEscapedCommand('output', true));test('"verbose" function receives verboseObject.escapedCommand, "error", sync', () => testVerboseEscapedCommand('error', true));test('"verbose" function receives verboseObject.escapedCommand, "duration", sync', () => testVerboseEscapedCommand('duration', true));