-
-
Notifications
You must be signed in to change notification settings - Fork 257
Fix fd-specific options to account for ipc
#1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ await execa('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const}); | |
| await execa('unicorns', {maxBuffer: {all: 0}}); | ||
| await execa('unicorns', {maxBuffer: {fd1: 0}}); | ||
| await execa('unicorns', {maxBuffer: {fd2: 0}}); | ||
| await execa('unicorns', {maxBuffer: {fd3: 0}}); | ||
| await execa('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should keep the original assertion as well (without the |
||
| await execa('unicorns', {maxBuffer: {ipc: 0}}); | ||
| expectError(await execa('unicorns', {maxBuffer: {stdout: '0'}})); | ||
|
|
||
|
|
@@ -21,7 +21,7 @@ execaSync('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const}); | |
| execaSync('unicorns', {maxBuffer: {all: 0}}); | ||
| execaSync('unicorns', {maxBuffer: {fd1: 0}}); | ||
| execaSync('unicorns', {maxBuffer: {fd2: 0}}); | ||
| execaSync('unicorns', {maxBuffer: {fd3: 0}}); | ||
| execaSync('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| execaSync('unicorns', {maxBuffer: {ipc: 0}}); | ||
| expectError(execaSync('unicorns', {maxBuffer: {stdout: '0'}})); | ||
|
|
||
|
|
@@ -33,7 +33,7 @@ await execa('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const}); | |
| await execa('unicorns', {verbose: {all: 'none'}}); | ||
| await execa('unicorns', {verbose: {fd1: 'none'}}); | ||
| await execa('unicorns', {verbose: {fd2: 'none'}}); | ||
| await execa('unicorns', {verbose: {fd3: 'none'}}); | ||
| await execa('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| await execa('unicorns', {verbose: {ipc: 'none'}}); | ||
| expectError(await execa('unicorns', {verbose: {stdout: 'other'}})); | ||
|
|
||
|
|
@@ -45,7 +45,7 @@ execaSync('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const}); | |
| execaSync('unicorns', {verbose: {all: 'none'}}); | ||
| execaSync('unicorns', {verbose: {fd1: 'none'}}); | ||
| execaSync('unicorns', {verbose: {fd2: 'none'}}); | ||
| execaSync('unicorns', {verbose: {fd3: 'none'}}); | ||
| execaSync('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| execaSync('unicorns', {verbose: {ipc: 'none'}}); | ||
| expectError(execaSync('unicorns', {verbose: {stdout: 'other'}})); | ||
|
|
||
|
|
@@ -57,7 +57,7 @@ await execa('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as cons | |
| await execa('unicorns', {stripFinalNewline: {all: true}}); | ||
| await execa('unicorns', {stripFinalNewline: {fd1: true}}); | ||
| await execa('unicorns', {stripFinalNewline: {fd2: true}}); | ||
| await execa('unicorns', {stripFinalNewline: {fd3: true}}); | ||
| await execa('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| await execa('unicorns', {stripFinalNewline: {ipc: true}}); | ||
| expectError(await execa('unicorns', {stripFinalNewline: {stdout: 'true'}})); | ||
|
|
||
|
|
@@ -69,7 +69,7 @@ execaSync('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as const} | |
| execaSync('unicorns', {stripFinalNewline: {all: true}}); | ||
| execaSync('unicorns', {stripFinalNewline: {fd1: true}}); | ||
| execaSync('unicorns', {stripFinalNewline: {fd2: true}}); | ||
| execaSync('unicorns', {stripFinalNewline: {fd3: true}}); | ||
| execaSync('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| execaSync('unicorns', {stripFinalNewline: {ipc: true}}); | ||
| expectError(execaSync('unicorns', {stripFinalNewline: {stdout: 'true'}})); | ||
|
|
||
|
|
@@ -81,7 +81,7 @@ await execa('unicorns', {lines: {stdout: true, stderr: true} as const}); | |
| await execa('unicorns', {lines: {all: true}}); | ||
| await execa('unicorns', {lines: {fd1: true}}); | ||
| await execa('unicorns', {lines: {fd2: true}}); | ||
| await execa('unicorns', {lines: {fd3: true}}); | ||
| await execa('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| await execa('unicorns', {lines: {ipc: true}}); | ||
| expectError(await execa('unicorns', {lines: {stdout: 'true'}})); | ||
|
|
||
|
|
@@ -93,7 +93,7 @@ execaSync('unicorns', {lines: {stdout: true, stderr: true} as const}); | |
| execaSync('unicorns', {lines: {all: true}}); | ||
| execaSync('unicorns', {lines: {fd1: true}}); | ||
| execaSync('unicorns', {lines: {fd2: true}}); | ||
| execaSync('unicorns', {lines: {fd3: true}}); | ||
| execaSync('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| execaSync('unicorns', {lines: {ipc: true}}); | ||
| expectError(execaSync('unicorns', {lines: {stdout: 'true'}})); | ||
|
|
||
|
|
@@ -105,7 +105,7 @@ await execa('unicorns', {buffer: {stdout: true, stderr: true} as const}); | |
| await execa('unicorns', {buffer: {all: true}}); | ||
| await execa('unicorns', {buffer: {fd1: true}}); | ||
| await execa('unicorns', {buffer: {fd2: true}}); | ||
| await execa('unicorns', {buffer: {fd3: true}}); | ||
| await execa('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| await execa('unicorns', {buffer: {ipc: true}}); | ||
| expectError(await execa('unicorns', {buffer: {stdout: 'true'}})); | ||
|
|
||
|
|
@@ -117,7 +117,7 @@ execaSync('unicorns', {buffer: {stdout: true, stderr: true} as const}); | |
| execaSync('unicorns', {buffer: {all: true}}); | ||
| execaSync('unicorns', {buffer: {fd1: true}}); | ||
| execaSync('unicorns', {buffer: {fd2: true}}); | ||
| execaSync('unicorns', {buffer: {fd3: true}}); | ||
| execaSync('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); | ||
| execaSync('unicorns', {buffer: {ipc: true}}); | ||
| expectError(execaSync('unicorns', {buffer: {stdout: 'true'}})); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,12 +3,14 @@ import {stripVTControlCharacters} from 'node:util'; | |
| import {replaceSymbols} from 'figures'; | ||
| import {foobarString} from './input.js'; | ||
| import {nestedSubprocess} from './nested.js'; | ||
| import {fullStdio} from './stdio.js'; | ||
|
|
||
| const isWindows = platform === 'win32'; | ||
| export const QUOTE = isWindows ? '"' : '\''; | ||
|
|
||
| export const runErrorSubprocess = async (t, verbose, isSync = false, expectExitCode = true) => { | ||
| const {stderr, nestedResult} = await nestedSubprocess('noop-fail.js', ['1', foobarString], {verbose, isSync}); | ||
| export const runErrorSubprocess = async (t, verbose, isSync = false, options = {}) => { | ||
| const {expectExitCode = true, ...subprocessOptions} = options; | ||
| const {stderr, nestedResult} = await nestedSubprocess('noop-fail.js', ['1', foobarString], {verbose, isSync, ...subprocessOptions}); | ||
| t.true(nestedResult instanceof Error); | ||
| if (expectExitCode) { | ||
| t.true(stderr.includes('exit code 2')); | ||
|
|
@@ -44,6 +46,7 @@ export const runVerboseSubprocess = ({ | |
| ...options | ||
| }) => nestedSubprocess('noop-verbose.js', [output], { | ||
| ipc: !isSync, | ||
| ...getStdioForFd3Option(fdNumber, secondFdNumber), | ||
| optionsFixture, | ||
| optionsInput: { | ||
| type, | ||
|
|
@@ -57,6 +60,10 @@ export const runVerboseSubprocess = ({ | |
| ...options, | ||
| }); | ||
|
|
||
| export const getStdioForFd3Option = (...values) => values.some(value => hasFd3Option(value)) ? fullStdio : {}; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand correctly, this is added to tests that use some
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not for runtime behavior. |
||
|
|
||
| const hasFd3Option = value => value === 'fd3' || (typeof value === 'object' && value !== null && Object.hasOwn(value, 'fd3')); | ||
|
|
||
| export const getCommandLine = stderr => getCommandLines(stderr)[0]; | ||
| export const getCommandLines = stderr => getNormalizedLines(stderr).filter(line => isCommandLine(line)); | ||
| const isCommandLine = line => line.includes(' $ ') || line.includes(' | '); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.