Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/changes/@microsoft/rush/main_2026-01-04-02-58.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-config-file",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft-config-file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/localization-utilities",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/localization-utilities"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/operation-graph",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/operation-graph"
}
10 changes: 10 additions & 0 deletions common/changes/@rushstack/terminal/main_2026-01-04-00-39.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/terminal",
"comment": "Add a `getAllOutputAsChunks` function to `StringBufferTerminalProvider` that returns an array of chunks that were written to the terminal provider.",
"type": "minor"
}
],
"packageName": "@rushstack/terminal"
}
27 changes: 25 additions & 2 deletions common/reviews/api/terminal.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ export interface INormalizeNewlinesTextRewriterOptions {
newlineKind: NewlineKind;
}

// @beta (undocumented)
export interface IOutputChunk {
// (undocumented)
severity: TerminalProviderSeverityName;
// (undocumented)
text: string;
}

// @beta (undocumented)
export type IPrefixProxyTerminalProviderOptions = IStaticPrefixProxyTerminalProviderOptions | IDynamicPrefixProxyTerminalProviderOptions;

Expand Down Expand Up @@ -192,9 +200,14 @@ export interface IStdioSummarizerOptions extends ITerminalWritableOptions {
trailingLines?: number;
}

// @beta (undocumented)
export interface IStringBufferOutputChunksOptions extends IStringBufferOutputOptions {
asLines?: boolean;
}

// @beta (undocumented)
export interface IStringBufferOutputOptions {
normalizeSpecialCharacters: boolean;
normalizeSpecialCharacters?: boolean;
}

// @beta (undocumented)
Expand Down Expand Up @@ -381,6 +394,13 @@ export class StringBufferTerminalProvider implements ITerminalProvider {
getAllOutput(sparse?: false, options?: IStringBufferOutputOptions): IAllStringBufferOutput;
// (undocumented)
getAllOutput(sparse: true, options?: IStringBufferOutputOptions): Partial<IAllStringBufferOutput>;
getAllOutputAsChunks(options?: IStringBufferOutputChunksOptions & {
asLines?: false;
}): IOutputChunk[];
// (undocumented)
getAllOutputAsChunks(options: IStringBufferOutputChunksOptions & {
asLines: true;
}): `[${string}] ${string}`[];
getDebugOutput(options?: IStringBufferOutputOptions): string;
getErrorOutput(options?: IStringBufferOutputOptions): string;
getOutput(options?: IStringBufferOutputOptions): string;
Expand All @@ -389,7 +409,7 @@ export class StringBufferTerminalProvider implements ITerminalProvider {
getVerboseOutput(options?: IStringBufferOutputOptions): string;
getWarningOutput(options?: IStringBufferOutputOptions): string;
readonly supportsColor: boolean;
write(data: string, severity: TerminalProviderSeverity): void;
write(text: string, severity: TerminalProviderSeverity): void;
}

// @beta
Expand Down Expand Up @@ -429,6 +449,9 @@ export enum TerminalProviderSeverity {
warning = 1
}

// @beta (undocumented)
export type TerminalProviderSeverityName = keyof typeof TerminalProviderSeverity;

// @beta
export class TerminalStreamWritable extends Writable {
constructor(options: ITerminalStreamWritableOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('ConfigurationFile', () => {
});

afterEach(() => {
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();
});

describe('A simple config file', () => {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Array [
]
`;

exports[`parseResx correctly ignores a string: terminal output 1`] = `Object {}`;
exports[`parseResx correctly ignores a string: terminal output 1`] = `Array []`;

exports[`parseResx fails to parse a RESX file with a duplicate string: Loc file 1`] = `
Object {
Expand All @@ -34,9 +34,9 @@ Object {
`;

exports[`parseResx fails to parse a RESX file with a duplicate string: terminal output 1`] = `
Object {
"error": "test.resx(6,45): Duplicate string value \\"stringA\\"[n]",
}
Array [
"[ error] test.resx(6,45): Duplicate string value \\"stringA\\"[n]",
]
`;

exports[`parseResx ignoreMissingResxComments when set to false, warns on a missing comment: Loc file 1`] = `
Expand All @@ -49,9 +49,9 @@ Object {
`;

exports[`parseResx ignoreMissingResxComments when set to false, warns on a missing comment: terminal output 1`] = `
Object {
"warning": "test.resx(3,59): Missing string comment in <data> element[n]",
}
Array [
"[warning] test.resx(3,59): Missing string comment in <data> element[n]",
]
`;

exports[`parseResx ignoreMissingResxComments when set to true, ignores a missing comment: Loc file 1`] = `
Expand All @@ -63,7 +63,7 @@ Object {
}
`;

exports[`parseResx ignoreMissingResxComments when set to true, ignores a missing comment: terminal output 1`] = `Object {}`;
exports[`parseResx ignoreMissingResxComments when set to true, ignores a missing comment: terminal output 1`] = `Array []`;

exports[`parseResx ignoreMissingResxComments when set to undefined, warns on a missing comment: Loc file 1`] = `
Object {
Expand All @@ -74,7 +74,7 @@ Object {
}
`;

exports[`parseResx ignoreMissingResxComments when set to undefined, warns on a missing comment: terminal output 1`] = `Object {}`;
exports[`parseResx ignoreMissingResxComments when set to undefined, warns on a missing comment: terminal output 1`] = `Array []`;

exports[`parseResx parses a valid file with a schema: Loc file 1`] = `
Object {
Expand All @@ -89,7 +89,7 @@ Object {
}
`;

exports[`parseResx parses a valid file with a schema: terminal output 1`] = `Object {}`;
exports[`parseResx parses a valid file with a schema: terminal output 1`] = `Array []`;

exports[`parseResx parses a valid file with quotemarks: Loc file 1`] = `
Object {
Expand All @@ -100,7 +100,7 @@ Object {
}
`;

exports[`parseResx parses a valid file with quotemarks: terminal output 1`] = `Object {}`;
exports[`parseResx parses a valid file with quotemarks: terminal output 1`] = `Array []`;

exports[`parseResx prints an error on invalid XML: Loc file 1`] = `
Object {
Expand All @@ -112,9 +112,9 @@ Object {
`;

exports[`parseResx prints an error on invalid XML: terminal output 1`] = `
Object {
"error": "test.resx(3,41): Found unexpected non-empty text node in RESX <data> element[n]",
}
Array [
"[ error] test.resx(3,41): Found unexpected non-empty text node in RESX <data> element[n]",
]
`;

exports[`parseResx resxNewlineNormalization when set to CrLf, normalizes to CrLf: Loc file 1`] = `
Expand All @@ -128,7 +128,7 @@ Object {
}
`;

exports[`parseResx resxNewlineNormalization when set to CrLf, normalizes to CrLf: terminal output 1`] = `Object {}`;
exports[`parseResx resxNewlineNormalization when set to CrLf, normalizes to CrLf: terminal output 1`] = `Array []`;

exports[`parseResx resxNewlineNormalization when set to Lf, normalizes to Lf: Loc file 1`] = `
Object {
Expand All @@ -141,4 +141,4 @@ Object {
}
`;

exports[`parseResx resxNewlineNormalization when set to Lf, normalizes to Lf: terminal output 1`] = `Object {}`;
exports[`parseResx resxNewlineNormalization when set to Lf, normalizes to Lf: terminal output 1`] = `Array []`;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe(parseResx.name, () => {
});

afterEach(() => {
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot('terminal output');
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot('terminal output');
});

async function testResxAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.NoOp);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();
});

it('handles trivial input', async () => {
Expand All @@ -87,7 +87,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.Success);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();

expect(operation.state?.status).toBe(OperationStatus.NoOp);
});
Expand Down Expand Up @@ -135,7 +135,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.Success);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();

expect(runAlpha).toHaveBeenCalledTimes(1);
expect(runBeta).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -187,7 +187,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.Failure);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();
expect(runAlpha).toHaveBeenCalledTimes(1);
expect(runBeta).toHaveBeenCalledTimes(0);

Expand Down Expand Up @@ -218,7 +218,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.NoOp);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();
});

it('respects priority order', async () => {
Expand Down Expand Up @@ -271,7 +271,7 @@ describe(OperationExecutionManager.name, () => {
expect(executed).toEqual([beta, alpha]);

expect(result).toBe(OperationStatus.Success);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();

expect(runAlpha).toHaveBeenCalledTimes(1);
expect(runBeta).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -324,7 +324,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result).toBe(OperationStatus.Success);
expect(terminalProvider.getAllOutput(true)).toMatchSnapshot();
expect(terminalProvider.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot();

expect(run).toHaveBeenCalledTimes(2);

Expand Down Expand Up @@ -391,7 +391,7 @@ describe(OperationExecutionManager.name, () => {
expect(betaRequestRun).toBeDefined();

expect(result1).toBe(OperationStatus.Success);
expect(terminalProvider1.getAllOutput(true)).toMatchSnapshot('first');
expect(terminalProvider1.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot('first');

expect(runAlpha).toHaveBeenCalledTimes(1);
expect(runBeta).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -423,7 +423,7 @@ describe(OperationExecutionManager.name, () => {
});

expect(result2).toBe(OperationStatus.Success);
expect(terminalProvider2.getAllOutput(true)).toMatchSnapshot('second');
expect(terminalProvider2.getAllOutputAsChunks({ asLines: true })).toMatchSnapshot('second');

expect(runAlpha).toHaveBeenCalledTimes(2);
expect(runBeta).toHaveBeenCalledTimes(2);
Expand Down
Loading
Loading