/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as mobxlite from 'mobx-react-lite'; import * as React from 'react'; import { TestRun } from '../stores/testRun'; import { Editor } from './editor'; type Props = { readonly run: TestRun; readonly baseline: TestRun | undefined; readonly expand: boolean; }; export const OutputView = mobxlite.observer(({ run, baseline, expand }: Props) => { const [expanded, setExpanded] = React.useState(expand); function ensureOutputValue(value: string | undefined): string { if (value) { return value; } return ''; } return (
setExpanded(!expanded)}> {expanded ? '▼' : '▶'} Output
{ !expanded ? null : (
{ !(run.stdout || (baseline && baseline.stdout)) ? null : ( <>

stdout

{ baseline ? ( <>

stdout from "Compare against" run

) : null }

stdout from "Current" run

) } { !(run.stderr || (baseline && baseline.stderr)) ? null : ( <>

stderr

{ baseline ? ( <>

stderr from "Compare against" run

) : null }

stderr from "Current" run

) }
) }
); });