Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

closes #116. Test output in editor#124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/test-output
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes fromall 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: 0 additions & 10 deletionssrc/editor/outputChannel.ts
View file
Open in desktop

This file was deleted.

9 changes: 3 additions & 6 deletionssrc/services/testRunner/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
import { getOutputChannel } from '../../editor/outputChannel'
import node from '../../services/node'
import logger from '../../services/logger'
import parser from './parser'
import { debounce, throttle } from './throttle'
import onError from '../sentry/onError'
import displayOutput from './output'

export interface Payload {
stepId: string
Expand All@@ -21,8 +21,6 @@ interface TestRunnerConfig {
}

const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => {
const outputChannelName = 'TEST_OUTPUT'

return async (payload: Payload, onSuccess?: () => void): Promise<void> => {
const startTime = throttle()
// throttle time early
Expand DownExpand Up@@ -58,13 +56,12 @@ const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => {
if (stdout && stdout.length && !tap.ok) {
const message = tap.message ? tap.message : ''
callbacks.onFail(payload, message)
displayOutput(stdout)
return
} else {
callbacks.onError(payload)
// open terminal with error string
const channel = getOutputChannel(outputChannelName)
channel.show(false)
channel.appendLine(stderr)
displayOutput(stderr)
return
}
}
Expand Down
31 changes: 31 additions & 0 deletionssrc/services/testRunner/output.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
import * as vscode from 'vscode'

let channel: vscode.OutputChannel

const getOutputChannel = (name: string): vscode.OutputChannel => {
if (!channel) {
channel = vscode.window.createOutputChannel(name)
}
return channel
}

const outputChannelName = 'TEST_OUTPUT'

const parseOutput = (text: string): string => {
let result = ''
for (const line of text.split(/\r?\n/)) {
if (line.match(/^#/) || line.match(/^not ok/)) {
result += line + '\n'
}
}
return result
}

const displayOutput = (text: string) => {
const channel = getOutputChannel(outputChannelName)
channel.show(true)
const output = parseOutput(text)
channel.append(output)
}

export default displayOutput

[8]ページ先頭

©2009-2025 Movatter.jp