({
})
| 95 | } |
| 96 | |
| 97 | export const UIModeView: React.FC<{}> = ({ |
| 98 | }) => { |
| 99 | const [filterText, setFilterText] = React.useState<string>(''); |
| 100 | const [isShowingOutput, setIsShowingOutput] = React.useState<boolean>(false); |
| 101 | const [outputContainsError, setOutputContainsError] = React.useState(false); |
| 102 | const [statusFilters, setStatusFilters] = React.useState<Map<string, boolean>>(new Map([ |
| 103 | ['passed', false], |
| 104 | ['failed', false], |
| 105 | ['skipped', false], |
| 106 | ])); |
| 107 | const [projectFilters, setProjectFilters] = React.useState<Map<string, boolean>>(new Map()); |
| 108 | const [testModel, setTestModel] = React.useState<TeleSuiteUpdaterTestModel>(); |
| 109 | const [progress, setProgress] = React.useState<TeleSuiteUpdaterProgress & { total: number } | undefined>(); |
| 110 | const [selectedItem, setSelectedItem] = React.useState<{ treeItem?: TreeItem, testFile?: SourceLocation, testCase?: reporterTypes.TestCase }>({}); |
| 111 | const [isLoading, setIsLoading] = React.useState<boolean>(false); |
| 112 | const [runningState, setRunningState] = React.useState<{ testIds: Set<string>, itemSelectedByUser?: boolean, completed?: boolean } | undefined>(); |
| 113 | const isRunningTest = runningState && !runningState.completed; |
| 114 | |
| 115 | const [watchAll, setWatchAll] = useSetting<boolean>('watch-all', false); |
| 116 | const [watchedTreeIds, setWatchedTreeIds] = React.useState<{ value: Set<string> }>({ value: new Set() }); |
| 117 | const commandQueue = React.useRef(Promise.resolve()); |
| 118 | const runTestBacklog = React.useRef<{ testIds: Set<string>, locations: Set<string> }>({ testIds: new Set(), locations: new Set() }); |
| 119 | const [collapseAllCount, setCollapseAllCount] = React.useState(0); |
| 120 | const [expandAllCount, setExpandAllCount] = React.useState(0); |
| 121 | const [isDisconnected, setIsDisconnected] = React.useState(false); |
| 122 | const [hasBrowsers, setHasBrowsers] = React.useState(true); |
| 123 | const [testServerConnection, setTestServerConnection] = React.useState<TestServerConnection>(); |
| 124 | const [teleSuiteUpdater, setTeleSuiteUpdater] = React.useState<TeleSuiteUpdater>(); |
| 125 | const [settingsVisible, setSettingsVisible] = React.useState(false); |
| 126 | const [testingOptionsVisible, setTestingOptionsVisible] = React.useState(false); |
| 127 | const [revealSource, setRevealSource] = React.useState(false); |
| 128 | const onRevealSource = React.useCallback(() => setRevealSource(true), [setRevealSource]); |
| 129 | |
| 130 | const [singleWorker, setSingleWorker] = useSetting<boolean>('single-worker', false); |
| 131 | const [updateSnapshots, setUpdateSnapshots] = useSetting<reporterTypes.FullConfig['updateSnapshots']>('updateSnapshots', 'missing'); |
| 132 | const [onlyChanged, setOnlyChanged] = useSetting<boolean>('only-changed', false); |
| 133 | const [stopOnFailure, setStopOnFailure] = useSetting<boolean>('stop-on-failure', false); |
| 134 | const [mergeFiles] = useSetting('mergeFiles', false); |
| 135 | |
| 136 | const inputRef = React.useRef<HTMLInputElement>(null); |
| 137 | |
| 138 | const reloadTests = React.useCallback(() => { |
| 139 | setTestServerConnection(prevConnection => { |
| 140 | prevConnection?.close(); |
| 141 | return new TestServerConnection(new WebSocketTestServerTransport(wsURL)); |
| 142 | }); |
| 143 | }, []); |
| 144 | |
| 145 | // Load tests on startup. |
| 146 | React.useEffect(() => { |
| 147 | inputRef.current?.focus(); |
| 148 | setIsLoading(true); |
| 149 | reloadTests(); |
| 150 | }, [reloadTests]); |
| 151 | |
| 152 | // Wire server connection to the auxiliary UI features. |
| 153 | React.useEffect(() => { |
| 154 | if (!testServerConnection) |
nothing calls this directly
no test coverage detected
searching dependent graphs…