Skip to content
Myr

Stricter values for the `encoding` option (#928)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent c9cdd2d · Browse files · 22 files+139 added−99 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

22 files+139 added−99 removed

  • tests:+39 added−38 removed
  • other:+100 added−61 removed

22 files+139 added−99 removed

added:lib/arguments/encoding.js+49 added
modified:lib/arguments/options.js+2 added
modified:lib/convert/add.js+2 added-2 removed
modified:lib/return/error.js+1 added-1 removed
1import {signalsByName} from 'human-signals';2import stripFinalNewline from 'strip-final-newline';3import {isUint8Array, uint8ArrayToString} from '../encoding.js';3import {isUint8Array, uint8ArrayToString} from '../utils.js';4import {fixCwdError} from '../arguments/cwd.js';5import {escapeLines} from '../arguments/escape.js';6import {getDurationMs} from './duration.js';7import {getFinalError, DiscardedError, isExecaError} from './cause.js';
189 unmodified lines
modified:lib/return/output.js+1 added-1 removed
modified:lib/stdio/encoding-final.js+2 added-2 removed
1import {StringDecoder} from 'node:string_decoder';2import {isSimpleEncoding} from '../encoding.js';23// Apply the `encoding` option using an implicit generator.4// This encodes the final output of `stdout`/`stderr`.5export const handleStreamsEncoding = ({stdioItems, options: {encoding}, isSync, direction, optionName}) => {
13 unmodified lines
19 }];20};2122const shouldEncodeOutput = ({stdioItems, encoding, isSync, direction}) => direction === 'output'24 && !isSimpleEncoding(encoding)23 && encoding !== 'utf8'24 && encoding !== 'buffer'25 && !isSync26 && !isWritableObjectMode(stdioItems);2728const isWritableObjectMode = stdioItems => {
14 unmodified lines
modified:lib/stdio/generator.js+2 added-2 removed
1import {isBinaryEncoding} from '../encoding.js';1import {BINARY_ENCODINGS} from '../arguments/encoding.js';2import {generatorsToTransform} from './transform.js';3import {getEncodingTransformGenerator} from './encoding-transform.js';4import {getSplitLinesGenerator, getAppendNewlineGenerator} from './split.js';5import {pipeStreams} from './pipeline.js';
20 unmodified lines
26 binary: binaryOption = false,27 preserveNewlines = false,28 objectMode,29 } = isGeneratorOptions(value) ? value : {transform: value};30 const binary = binaryOption || isBinaryEncoding(encoding);30 const binary = binaryOption || BINARY_ENCODINGS.has(encoding);31 const objectModes = direction === 'output'32 ? getOutputObjectModes(objectMode, index, newGenerators)33 : getInputObjectModes(objectMode, index, newGenerators);34 return {...stdioItem, value: {transform, final, binary, preserveNewlines, ...objectModes}};
79 unmodified lines
modified:lib/stdio/input.js+1 added-1 removed
1import {isReadableStream} from 'is-stream';2import {isUint8Array} from '../encoding.js';2import {isUint8Array} from '../utils.js';3import {isUrl, isFilePathString} from './type.js';45// Append the `stdin` option with the `input` and `inputFile` options6export const handleInputOptions = ({input, inputFile}, fdNumber) => fdNumber === 0
44 unmodified lines
modified:lib/stdio/lines.js+2 added-2 removed
1import {isBinaryEncoding} from '../encoding.js';1import {BINARY_ENCODINGS} from '../arguments/encoding.js';23// Split chunks line-wise for streams exposed to users like `subprocess.stdout`.4// Appending a noop transform in object mode is enough to do this, since every non-binary transform iterates line-wise.5export const handleStreamsLines = ({options: {lines, encoding, stripFinalNewline}, isSync, direction, optionName}) => shouldSplitLines({lines, encoding, isSync, direction})
5 unmodified lines
11 : [];1213const shouldSplitLines = ({lines, encoding, isSync, direction}) => direction === 'output'14 && lines15 && !isBinaryEncoding(encoding)15 && !BINARY_ENCODINGS.has(encoding)16 && !isSync;1718const linesEndGenerator = function * (chunk) {19 yield chunk;
1 unmodified line
modified:lib/stdio/sync.js+1 added-1 removed
1import {readFileSync, writeFileSync} from 'node:fs';2import {bufferToUint8Array, uint8ArrayToString} from '../encoding.js';2import {bufferToUint8Array, uint8ArrayToString} from '../utils.js';3import {handleInput} from './handle.js';4import {TYPE_TO_MESSAGE} from './type.js';56// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in sync mode
74 unmodified lines
modified:lib/stdio/type.js+1 added-1 removed
1import {isStream as isNodeStream} from 'is-stream';2import {isUint8Array} from '../encoding.js';2import {isUint8Array} from '../utils.js';34// The `stdin`/`stdout`/`stderr` option can be of many types. This detects it.5export const getStdioItemType = (value, optionName) => {6 if (isGenerator(value)) {
96 unmodified lines
modified:lib/stdio/validate.js+1 added-1 removed
1import {Buffer} from 'node:buffer';2import {isUint8Array} from '../encoding.js';2import {isUint8Array} from '../utils.js';34export const getValidateTransformReturn = (readableObjectMode, optionName) => readableObjectMode5 ? validateObjectTransformReturn.bind(undefined, optionName)6 : validateStringTransformReturn.bind(undefined, optionName);
24 unmodified lines
modified:lib/stream/all.js+1 added-2 removed
1import mergeStreams from '@sindresorhus/merge-streams';2import {generatorToDuplexStream} from '../stdio/generator.js';3import {isBufferEncoding} from '../encoding.js';3import {waitForSubprocessStream} from './subprocess.js';45// `all` interleaves `stdout` and `stderr`6export const makeAllStream = ({stdout, stderr}, {all}) => all && (stdout || stderr)
21 unmodified lines
2829const getAllStreamTransform = encoding => ({30 value: {31 * final() {},33 binary: isBufferEncoding(encoding),32 binary: encoding === 'buffer',33 writableObjectMode: true,34 readableObjectMode: true,35 preserveNewlines: true,36 },
3 unmodified lines
modified:lib/stream/subprocess.js+2 added-3 removed
1import {setImmediate} from 'node:timers/promises';2import getStream, {getStreamAsArrayBuffer, getStreamAsArray, MaxBufferError} from 'get-stream';3import {isBufferEncoding} from '../encoding.js';3import {waitForStream, handleStreamError, isInputFileDescriptor} from './wait.js';45export const waitForSubprocessStream = async ({stream, subprocess, fdNumber, encoding, buffer, maxBuffer, streamInfo}) => {6 if (!stream) {
38 unmodified lines
45 if (stream.readableObjectMode) {46 return getStreamAsArray(stream, {maxBuffer});47 }4850 const contents = isBufferEncoding(encoding)49 const contents = encoding === 'buffer'50 ? await getStreamAsArrayBuffer(stream, {maxBuffer})51 : await getStream(stream, {maxBuffer});52 return applyEncoding(contents, encoding);53};
12 unmodified lines
66const handleBufferedData = (error, encoding) => error.bufferedData === undefined || Array.isArray(error.bufferedData)67 ? error.bufferedData68 : applyEncoding(error.bufferedData, encoding);6971const applyEncoding = (contents, encoding) => isBufferEncoding(encoding) ? new Uint8Array(contents) : contents;70const applyEncoding = (contents, encoding) => encoding === 'buffer' ? new Uint8Array(contents) : contents;
modified:lib/verbose/output.js+2 added-2 removed
1import {inspect} from 'node:util';2import {escapeLines} from '../arguments/escape.js';3import {isBinaryEncoding} from '../encoding.js';3import {BINARY_ENCODINGS} from '../arguments/encoding.js';4import {PIPED_STDIO_VALUES} from '../stdio/forward.js';5import {verboseLog} from './log.js';67export const handleStreamsVerbose = ({stdioItems, options, isSync, stdioState, verboseInfo, fdNumber, optionName}) => shouldLogOutput({stdioItems, options, isSync, verboseInfo, fdNumber})
10 unmodified lines
18// They can also lead to double printing when passing file descriptor integers or `process.std*`.19// This only leaves with `pipe` and `overlapped`.20const shouldLogOutput = ({stdioItems, options: {encoding}, isSync, verboseInfo: {verbose}, fdNumber}) => verbose === 'full'21 && !isSync22 && !isBinaryEncoding(encoding)22 && !BINARY_ENCODINGS.has(encoding)23 && fdUsesVerbose(fdNumber)24 && (stdioItems.some(({type, value}) => type === 'native' && PIPED_STDIO_VALUES.has(value))25 || stdioItems.every(({type}) => type === 'generator'));26
33 unmodified lines
deleted:lib/encoding.js-19 removed
1import {Buffer} from 'node:buffer';23export const isSimpleEncoding = encoding => isBufferEncoding(encoding) || DEFAULT_ENCODING.has(encoding.toLowerCase());45// eslint-disable-next-line unicorn/text-encoding-identifier-case6const DEFAULT_ENCODING = new Set(['utf8', 'utf-8']);78export const isBufferEncoding = encoding => encoding === null || encoding.toLowerCase() === 'buffer';910export const isBinaryEncoding = encoding => isBufferEncoding(encoding) || BINARY_ENCODINGS.has(encoding.toLowerCase());1112const BINARY_ENCODINGS = new Set(['hex', 'base64', 'base64url', 'latin1', 'binary', 'ascii']);1314export const bufferToUint8Array = buffer => new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);1516export const isUint8Array = value => Object.prototype.toString.call(value) === '[object Uint8Array]' && !Buffer.isBuffer(value);1718const textDecoder = new TextDecoder();19export const uint8ArrayToString = uint8Array => textDecoder.decode(uint8Array);
modified:lib/script.js+1 added-2 removed
1import isPlainObject from 'is-plain-obj';2import {isUint8Array, uint8ArrayToString} from './encoding.js';3import {isSubprocess} from './utils.js';2import {isUint8Array, uint8ArrayToString, isSubprocess} from './utils.js';3import {execa} from './async.js';4import {execaSync} from './sync.js';56export const create$ = options => {
170 unmodified lines
modified:lib/utils.js+8 added
1import {Buffer} from 'node:buffer';2import {ChildProcess} from 'node:child_process';3import {addAbortListener} from 'node:events';4import process from 'node:process';56export const isUint8Array = value => Object.prototype.toString.call(value) === '[object Uint8Array]' && !Buffer.isBuffer(value);78export const bufferToUint8Array = buffer => new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);910const textDecoder = new TextDecoder();11export const uint8ArrayToString = uint8Array => textDecoder.decode(uint8Array);1213export const isStandardStream = stream => STANDARD_STREAMS.includes(stream);14export const STANDARD_STREAMS = [process.stdin, process.stdout, process.stderr];15export const STANDARD_STREAMS_ALIASES = ['stdin', 'stdout', 'stderr'];16
13 unmodified lines
added:test/arguments/encoding.js+39 added
1import test from 'ava';2import {execa, execaSync} from '../../index.js';3import {setFixtureDir} from '../helpers/fixtures-dir.js';45setFixtureDir();67const testInvalidEncoding = (t, encoding, message, execaMethod) => {8 const error = t.throws(() => {9 execaMethod('empty.js', {encoding});10 });11 t.true(error.message.includes(message));12};1314const UNKNOWN_ENCODING_MESSAGE = 'Please rename it to one of';15const getCorrectEncodingMessage = correctEncoding => `Please rename it to "${correctEncoding}"`;1617test('cannot pass unknown encodings', testInvalidEncoding, 'unknown', UNKNOWN_ENCODING_MESSAGE, execa);18test('cannot pass unknown encodings, sync', testInvalidEncoding, 'unknown', UNKNOWN_ENCODING_MESSAGE, execaSync);19test('cannot pass empty encodings', testInvalidEncoding, '', UNKNOWN_ENCODING_MESSAGE, execa);20test('cannot pass encoding: false', testInvalidEncoding, false, UNKNOWN_ENCODING_MESSAGE, execa);21test('cannot pass encoding: Symbol', testInvalidEncoding, Symbol('test'), UNKNOWN_ENCODING_MESSAGE, execa);22test('cannot pass encoding: null', testInvalidEncoding, null, getCorrectEncodingMessage('buffer'), execa);23test('cannot pass encoding: null, sync', testInvalidEncoding, null, getCorrectEncodingMessage('buffer'), execaSync);24/* eslint-disable unicorn/text-encoding-identifier-case */25test('cannot pass encoding: utf-8', testInvalidEncoding, 'utf-8', getCorrectEncodingMessage('utf8'), execa);26test('cannot pass encoding: utf-8, sync', testInvalidEncoding, 'utf-8', getCorrectEncodingMessage('utf8'), execaSync);27test('cannot pass encoding: UTF-8', testInvalidEncoding, 'UTF-8', getCorrectEncodingMessage('utf8'), execa);28test('cannot pass encoding: UTF-8, sync', testInvalidEncoding, 'UTF-8', getCorrectEncodingMessage('utf8'), execaSync);29test('cannot pass encoding: UTF8', testInvalidEncoding, 'UTF8', getCorrectEncodingMessage('utf8'), execa);30test('cannot pass encoding: UTF8, sync', testInvalidEncoding, 'UTF8', getCorrectEncodingMessage('utf8'), execaSync);31/* eslint-enable unicorn/text-encoding-identifier-case */32test('cannot pass encoding: utf-16le', testInvalidEncoding, 'utf-16le', getCorrectEncodingMessage('utf16le'), execa);33test('cannot pass encoding: UTF-16LE', testInvalidEncoding, 'UTF-16LE', getCorrectEncodingMessage('utf16le'), execa);34test('cannot pass encoding: UTF16LE', testInvalidEncoding, 'UTF16LE', getCorrectEncodingMessage('utf16le'), execa);35test('cannot pass encoding: ucs2', testInvalidEncoding, 'ucs2', getCorrectEncodingMessage('utf16le'), execa);36test('cannot pass encoding: UCS2', testInvalidEncoding, 'UCS2', getCorrectEncodingMessage('utf16le'), execa);37test('cannot pass encoding: ucs-2', testInvalidEncoding, 'ucs-2', getCorrectEncodingMessage('utf16le'), execa);38test('cannot pass encoding: UCS-2', testInvalidEncoding, 'UCS-2', getCorrectEncodingMessage('utf16le'), execa);39test('cannot pass encoding: binary', testInvalidEncoding, 'binary', getCorrectEncodingMessage('latin1'), execa);
modified:test/stdio/encoding-final.js-38 removed
45 unmodified lines
46// This string gives different outputs with each encoding type47const STRING_TO_ENCODE = '\u1000.';48const BUFFER_TO_ENCODE = Buffer.from(STRING_TO_ENCODE);4950/* eslint-disable unicorn/text-encoding-identifier-case */50test('can pass encoding "buffer" to stdout', checkEncoding, 'buffer', 1, execa);51test('can pass encoding "utf8" to stdout', checkEncoding, 'utf8', 1, execa);53test('can pass encoding "utf-8" to stdout', checkEncoding, 'utf-8', 1, execa);52test('can pass encoding "utf16le" to stdout', checkEncoding, 'utf16le', 1, execa);55test('can pass encoding "utf-16le" to stdout', checkEncoding, 'utf-16le', 1, execa);56test('can pass encoding "ucs2" to stdout', checkEncoding, 'ucs2', 1, execa);57test('can pass encoding "ucs-2" to stdout', checkEncoding, 'ucs-2', 1, execa);53test('can pass encoding "latin1" to stdout', checkEncoding, 'latin1', 1, execa);59test('can pass encoding "binary" to stdout', checkEncoding, 'binary', 1, execa);54test('can pass encoding "ascii" to stdout', checkEncoding, 'ascii', 1, execa);55test('can pass encoding "hex" to stdout', checkEncoding, 'hex', 1, execa);56test('can pass encoding "base64" to stdout', checkEncoding, 'base64', 1, execa);57test('can pass encoding "base64url" to stdout', checkEncoding, 'base64url', 1, execa);58test('can pass encoding "buffer" to stderr', checkEncoding, 'buffer', 2, execa);59test('can pass encoding "utf8" to stderr', checkEncoding, 'utf8', 2, execa);66test('can pass encoding "utf-8" to stderr', checkEncoding, 'utf-8', 2, execa);60test('can pass encoding "utf16le" to stderr', checkEncoding, 'utf16le', 2, execa);68test('can pass encoding "utf-16le" to stderr', checkEncoding, 'utf-16le', 2, execa);69test('can pass encoding "ucs2" to stderr', checkEncoding, 'ucs2', 2, execa);70test('can pass encoding "ucs-2" to stderr', checkEncoding, 'ucs-2', 2, execa);61test('can pass encoding "latin1" to stderr', checkEncoding, 'latin1', 2, execa);72test('can pass encoding "binary" to stderr', checkEncoding, 'binary', 2, execa);62test('can pass encoding "ascii" to stderr', checkEncoding, 'ascii', 2, execa);63test('can pass encoding "hex" to stderr', checkEncoding, 'hex', 2, execa);64test('can pass encoding "base64" to stderr', checkEncoding, 'base64', 2, execa);65test('can pass encoding "base64url" to stderr', checkEncoding, 'base64url', 2, execa);66test('can pass encoding "buffer" to stdio[*]', checkEncoding, 'buffer', 3, execa);67test('can pass encoding "utf8" to stdio[*]', checkEncoding, 'utf8', 3, execa);79test('can pass encoding "utf-8" to stdio[*]', checkEncoding, 'utf-8', 3, execa);68test('can pass encoding "utf16le" to stdio[*]', checkEncoding, 'utf16le', 3, execa);81test('can pass encoding "utf-16le" to stdio[*]', checkEncoding, 'utf-16le', 3, execa);82test('can pass encoding "ucs2" to stdio[*]', checkEncoding, 'ucs2', 3, execa);83test('can pass encoding "ucs-2" to stdio[*]', checkEncoding, 'ucs-2', 3, execa);69test('can pass encoding "latin1" to stdio[*]', checkEncoding, 'latin1', 3, execa);85test('can pass encoding "binary" to stdio[*]', checkEncoding, 'binary', 3, execa);70test('can pass encoding "ascii" to stdio[*]', checkEncoding, 'ascii', 3, execa);71test('can pass encoding "hex" to stdio[*]', checkEncoding, 'hex', 3, execa);72test('can pass encoding "base64" to stdio[*]', checkEncoding, 'base64', 3, execa);73test('can pass encoding "base64url" to stdio[*]', checkEncoding, 'base64url', 3, execa);74test('can pass encoding "buffer" to stdout - sync', checkEncoding, 'buffer', 1, execaSync);75test('can pass encoding "utf8" to stdout - sync', checkEncoding, 'utf8', 1, execaSync);92test('can pass encoding "utf-8" to stdout - sync', checkEncoding, 'utf-8', 1, execaSync);76test('can pass encoding "utf16le" to stdout - sync', checkEncoding, 'utf16le', 1, execaSync);94test('can pass encoding "utf-16le" to stdout - sync', checkEncoding, 'utf-16le', 1, execaSync);95test('can pass encoding "ucs2" to stdout - sync', checkEncoding, 'ucs2', 1, execaSync);96test('can pass encoding "ucs-2" to stdout - sync', checkEncoding, 'ucs-2', 1, execaSync);77test('can pass encoding "latin1" to stdout - sync', checkEncoding, 'latin1', 1, execaSync);98test('can pass encoding "binary" to stdout - sync', checkEncoding, 'binary', 1, execaSync);78test('can pass encoding "ascii" to stdout - sync', checkEncoding, 'ascii', 1, execaSync);79test('can pass encoding "hex" to stdout - sync', checkEncoding, 'hex', 1, execaSync);80test('can pass encoding "base64" to stdout - sync', checkEncoding, 'base64', 1, execaSync);81test('can pass encoding "base64url" to stdout - sync', checkEncoding, 'base64url', 1, execaSync);82test('can pass encoding "buffer" to stderr - sync', checkEncoding, 'buffer', 2, execaSync);83test('can pass encoding "utf8" to stderr - sync', checkEncoding, 'utf8', 2, execaSync);105test('can pass encoding "utf-8" to stderr - sync', checkEncoding, 'utf-8', 2, execaSync);84test('can pass encoding "utf16le" to stderr - sync', checkEncoding, 'utf16le', 2, execaSync);107test('can pass encoding "utf-16le" to stderr - sync', checkEncoding, 'utf-16le', 2, execaSync);108test('can pass encoding "ucs2" to stderr - sync', checkEncoding, 'ucs2', 2, execaSync);109test('can pass encoding "ucs-2" to stderr - sync', checkEncoding, 'ucs-2', 2, execaSync);85test('can pass encoding "latin1" to stderr - sync', checkEncoding, 'latin1', 2, execaSync);111test('can pass encoding "binary" to stderr - sync', checkEncoding, 'binary', 2, execaSync);86test('can pass encoding "ascii" to stderr - sync', checkEncoding, 'ascii', 2, execaSync);87test('can pass encoding "hex" to stderr - sync', checkEncoding, 'hex', 2, execaSync);88test('can pass encoding "base64" to stderr - sync', checkEncoding, 'base64', 2, execaSync);89test('can pass encoding "base64url" to stderr - sync', checkEncoding, 'base64url', 2, execaSync);90test('can pass encoding "buffer" to stdio[*] - sync', checkEncoding, 'buffer', 3, execaSync);91test('can pass encoding "utf8" to stdio[*] - sync', checkEncoding, 'utf8', 3, execaSync);118test('can pass encoding "utf-8" to stdio[*] - sync', checkEncoding, 'utf-8', 3, execaSync);92test('can pass encoding "utf16le" to stdio[*] - sync', checkEncoding, 'utf16le', 3, execaSync);120test('can pass encoding "utf-16le" to stdio[*] - sync', checkEncoding, 'utf-16le', 3, execaSync);121test('can pass encoding "ucs2" to stdio[*] - sync', checkEncoding, 'ucs2', 3, execaSync);122test('can pass encoding "ucs-2" to stdio[*] - sync', checkEncoding, 'ucs-2', 3, execaSync);93test('can pass encoding "latin1" to stdio[*] - sync', checkEncoding, 'latin1', 3, execaSync);124test('can pass encoding "binary" to stdio[*] - sync', checkEncoding, 'binary', 3, execaSync);94test('can pass encoding "ascii" to stdio[*] - sync', checkEncoding, 'ascii', 3, execaSync);95test('can pass encoding "hex" to stdio[*] - sync', checkEncoding, 'hex', 3, execaSync);96test('can pass encoding "base64" to stdio[*] - sync', checkEncoding, 'base64', 3, execaSync);97test('can pass encoding "base64url" to stdio[*] - sync', checkEncoding, 'base64url', 3, execaSync);129/* eslint-enable unicorn/text-encoding-identifier-case */98131test('validate unknown encodings', t => {132 t.throws(() => {133 execa('noop.js', {encoding: 'unknownEncoding'});134 }, {code: 'ERR_UNKNOWN_ENCODING'});135});13699const foobarArray = ['fo', 'ob', 'ar', '..'];100101const testMultibyteCharacters = async (t, objectMode, addNoopTransform) => {102 const {stdout} = await execa('noop.js', {
66 unmodified lines
modified:index.d.ts+1 added-7 removed
85 unmodified lines
8687type DefaultEncodingOption = 'utf8';88type TextEncodingOption =89 | DefaultEncodingOption90 // eslint-disable-next-line unicorn/text-encoding-identifier-case91 | 'utf-8'92 | 'utf16le'90 | 'utf16le';93 | 'utf-16le'94 | 'ucs2'95 | 'ucs-2';91type BufferEncodingOption = 'buffer';92type BinaryEncodingOption =93 | BufferEncodingOption94 | 'hex'95 | 'base64'96 | 'base64url'97 | 'latin1'103 | 'binary'98 | 'ascii';99type EncodingOption =100 | TextEncodingOption101 | BinaryEncodingOption
1487 unmodified lines
modified:index.test-d.ts+20 added-12 removed
1061 unmodified lines
1062execa('unicorns', {localDir: '.'});1063execaSync('unicorns', {localDir: '.'});1064execa('unicorns', {localDir: fileUrl});1065execaSync('unicorns', {localDir: fileUrl});1066// eslint-disable-next-line unicorn/text-encoding-identifier-case1067execa('unicorns', {encoding: 'utf-8'});1068// eslint-disable-next-line unicorn/text-encoding-identifier-case1069execaSync('unicorns', {encoding: 'utf-8'});1066execa('unicorns', {encoding: 'utf8'});1067execaSync('unicorns', {encoding: 'utf8'});1068/* eslint-disable unicorn/text-encoding-identifier-case */1069expectError(execa('unicorns', {encoding: 'utf-8'}));1070expectError(execaSync('unicorns', {encoding: 'utf-8'}));1071expectError(execa('unicorns', {encoding: 'UTF8'}));1072expectError(execaSync('unicorns', {encoding: 'UTF8'}));1073/* eslint-enable unicorn/text-encoding-identifier-case */1074execa('unicorns', {encoding: 'utf16le'});1075execaSync('unicorns', {encoding: 'utf16le'});1072execa('unicorns', {encoding: 'utf-16le'});1073execaSync('unicorns', {encoding: 'utf-16le'});1074execa('unicorns', {encoding: 'ucs2'});1075execaSync('unicorns', {encoding: 'ucs2'});1076execa('unicorns', {encoding: 'ucs-2'});1077execaSync('unicorns', {encoding: 'ucs-2'});1076expectError(execa('unicorns', {encoding: 'utf-16le'}));1077expectError(execaSync('unicorns', {encoding: 'utf-16le'}));1078expectError(execa('unicorns', {encoding: 'ucs2'}));1079expectError(execaSync('unicorns', {encoding: 'ucs2'}));1080expectError(execa('unicorns', {encoding: 'ucs-2'}));1081expectError(execaSync('unicorns', {encoding: 'ucs-2'}));1082execa('unicorns', {encoding: 'buffer'});1083execaSync('unicorns', {encoding: 'buffer'});1084expectError(execa('unicorns', {encoding: null}));1085expectError(execaSync('unicorns', {encoding: null}));1086execa('unicorns', {encoding: 'hex'});1087execaSync('unicorns', {encoding: 'hex'});1088execa('unicorns', {encoding: 'base64'});1089execaSync('unicorns', {encoding: 'base64'});1090execa('unicorns', {encoding: 'base64url'});1091execaSync('unicorns', {encoding: 'base64url'});1092execa('unicorns', {encoding: 'latin1'});1093execaSync('unicorns', {encoding: 'latin1'});1086execa('unicorns', {encoding: 'binary'});1087execaSync('unicorns', {encoding: 'binary'});1094expectError(execa('unicorns', {encoding: 'binary'}));1095expectError(execaSync('unicorns', {encoding: 'binary'}));1096execa('unicorns', {encoding: 'ascii'});1097execaSync('unicorns', {encoding: 'ascii'});1098expectError(execa('unicorns', {encoding: 'unknownEncoding'}));1099expectError(execaSync('unicorns', {encoding: 'unknownEncoding'}));
689 unmodified lines