From 2bbea4f2fe8993716ebab041d956b7d5a45330b0 Mon Sep 17 00:00:00 2001 From: shmck Date: Sat, 7 Mar 2020 16:20:29 -0800 Subject: [PATCH] closes #126. show/hide console on tests --- src/services/testRunner/index.ts | 3 ++- src/services/testRunner/output.ts | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/services/testRunner/index.ts b/src/services/testRunner/index.ts index 93cb3a64..0cbd6cde 100644 --- a/src/services/testRunner/index.ts +++ b/src/services/testRunner/index.ts @@ -3,7 +3,7 @@ import logger from '../../services/logger' import parser from './parser' import { debounce, throttle } from './throttle' import onError from '../sentry/onError' -import displayOutput from './output' +import { clearOutput, displayOutput } from './output' export interface Payload { stepId: string @@ -68,6 +68,7 @@ const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => { // success! if (tap.ok) { + clearOutput() callbacks.onSuccess(payload) if (onSuccess) { onSuccess() diff --git a/src/services/testRunner/output.ts b/src/services/testRunner/output.ts index 9640e328..ce988d5c 100644 --- a/src/services/testRunner/output.ts +++ b/src/services/testRunner/output.ts @@ -9,7 +9,7 @@ const getOutputChannel = (name: string): vscode.OutputChannel => { return channel } -const outputChannelName = 'TEST_OUTPUT' +const outputChannelName = 'CodeRoad Output' const parseOutput = (text: string): string => { let result = '' @@ -21,11 +21,17 @@ const parseOutput = (text: string): string => { return result } -const displayOutput = (text: string) => { +export const displayOutput = (text: string) => { const channel = getOutputChannel(outputChannelName) + channel.clear() channel.show(true) const output = parseOutput(text) channel.append(output) } -export default displayOutput +export const clearOutput = () => { + const channel = getOutputChannel(outputChannelName) + channel.show(false) + channel.clear() + channel.hide() +}