Path: blob/main/extensions/copilot/test/simulation/workbench/components/output.tsx
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as mobxlite from 'mobx-react-lite';6import * as React from 'react';7import { TestRun } from '../stores/testRun';8import { Editor } from './editor';910type Props = {11readonly run: TestRun;12readonly baseline: TestRun | undefined;13readonly expand: boolean;14};1516export const OutputView = mobxlite.observer(({ run, baseline, expand }: Props) => {1718const [expanded, setExpanded] = React.useState(expand);1920function ensureOutputValue(value: string | undefined): string {21if (value) {22return value;23}2425return '';26}2728return (29<div className='request-container'>30<div className='title' onClick={() => setExpanded(!expanded)}>31{expanded ? '▼' : '▶'} Output32</div>33{34!expanded35? null36: (37<div className='request-details' style={{ borderLeft: '1px solid #ccc', marginLeft: '7px', paddingLeft: '5px' }}>38{39!(run.stdout || (baseline && baseline.stdout))40? null41: (42<>43<h3>stdout</h3>44{45baseline46? (47<>48<h4>stdout from "Compare against" run</h4>49<div style={{ marginLeft: '-10px' }}>50<Editor lineNumbers={false} languageId='markdown' contents={ensureOutputValue(baseline.stdout)} />51</div>52</>53)54: null55}56<h4>stdout from "Current" run</h4>57<div style={{ marginLeft: '-10px' }}>58<Editor lineNumbers={false} languageId='markdown' contents={ensureOutputValue(run.stdout)} />59</div>6061</>62)63}64{65!(run.stderr || (baseline && baseline.stderr))66? null67: (68<>69<h3>stderr</h3>70{71baseline72? (73<>74<h4>stderr from "Compare against" run</h4>75<div style={{ marginLeft: '-10px' }}>76<Editor lineNumbers={false} languageId='markdown' contents={ensureOutputValue(baseline.stderr)} />77</div>78</>79)80: null81}82<h4>stderr from "Current" run</h4>83<div style={{ marginLeft: '-10px' }}>84<Editor lineNumbers={false} languageId='markdown' contents={ensureOutputValue(run.stderr)} />85</div>86</>87)88}89</div>90)91}92</div>93);94});959697