File tree Expand file tree Collapse file tree 8 files changed +33
-10
lines changed Expand file tree Collapse file tree 8 files changed +33
-10
lines changed Original file line number Diff line number Diff line change 12
12
"no-throw-literal" : " warn" ,
13
13
// TODO "@typescript-eslint/semi" rule moved to https://eslint.style
14
14
"semi" : " error" ,
15
+ "no-console" : " warn" ,
15
16
// Mostly fails tests, ex. expect(...).to.be.true returns a Chai.Assertion
16
17
"@typescript-eslint/no-unused-expressions" : " off" ,
17
18
"@typescript-eslint/no-non-null-assertion" : " off" ,
Original file line number Diff line number Diff line change @@ -735,7 +735,11 @@ export class TestRunner {
735
735
const xUnitParser = new TestXUnitParser (
736
736
this . folderContext . workspaceContext . toolchain . hasMultiLineParallelTestOutput
737
737
) ;
738
- const results = await xUnitParser . parse ( buffer , runState ) ;
738
+ const results = await xUnitParser . parse (
739
+ buffer ,
740
+ runState ,
741
+ this . workspaceContext . outputChannel
742
+ ) ;
739
743
if ( results ) {
740
744
this . testRun . appendOutput (
741
745
`\r\nExecuted ${ results . tests } tests, with ${ results . failures } failures and ${ results . errors } errors.\r\n`
@@ -865,9 +869,13 @@ export class TestRunner {
865
869
) ;
866
870
867
871
const outputHandler = this . testOutputHandler ( config . testType , runState ) ;
868
- LoggingDebugAdapterTracker . setDebugSessionCallback ( session , output => {
869
- outputHandler ( output ) ;
870
- } ) ;
872
+ LoggingDebugAdapterTracker . setDebugSessionCallback (
873
+ session ,
874
+ this . workspaceContext . outputChannel ,
875
+ output => {
876
+ outputHandler ( output ) ;
877
+ }
878
+ ) ;
871
879
872
880
const cancellation = this . testRun . token . onCancellationRequested ( ( ) => {
873
881
this . workspaceContext . outputChannel . logDiagnostic (
Original file line number Diff line number Diff line change 14
14
15
15
import * as xml2js from "xml2js" ;
16
16
import { TestRunnerTestRunState } from "./TestRunner" ;
17
+ import { OutputChannel } from "vscode" ;
17
18
18
19
export interface TestResults {
19
20
tests : number ;
@@ -48,14 +49,15 @@ export class TestXUnitParser {
48
49
49
50
async parse (
50
51
buffer : string ,
51
- runState : TestRunnerTestRunState
52
+ runState : TestRunnerTestRunState ,
53
+ outputChannel : OutputChannel
52
54
) : Promise < TestResults | undefined > {
53
55
const xml = await xml2js . parseStringPromise ( buffer ) ;
54
56
try {
55
57
return await this . parseXUnit ( xml , runState ) ;
56
58
} catch ( error ) {
57
59
// ignore error
58
- console . log ( error ) ;
60
+ outputChannel . appendLine ( `Error parsing xUnit output: ${ error } ` ) ;
59
61
return undefined ;
60
62
}
61
63
}
Original file line number Diff line number Diff line change @@ -253,6 +253,7 @@ export class WorkspaceContext implements vscode.Disposable {
253
253
// add event listener for when a workspace folder is added/removed
254
254
const onWorkspaceChange = vscode . workspace . onDidChangeWorkspaceFolders ( event => {
255
255
if ( this === undefined ) {
256
+ // eslint-disable-next-line no-console
256
257
console . log ( "Trying to run onDidChangeWorkspaceFolders on deleted context" ) ;
257
258
return ;
258
259
}
@@ -261,6 +262,7 @@ export class WorkspaceContext implements vscode.Disposable {
261
262
// add event listener for when the active edited text document changes
262
263
const onDidChangeActiveWindow = vscode . window . onDidChangeActiveTextEditor ( async editor => {
263
264
if ( this === undefined ) {
265
+ // eslint-disable-next-line no-console
264
266
console . log ( "Trying to run onDidChangeWorkspaceFolders on deleted context" ) ;
265
267
return ;
266
268
}
Original file line number Diff line number Diff line change 15
15
import * as vscode from "vscode" ;
16
16
import { DebugAdapter } from "./debugAdapter" ;
17
17
import { Version } from "../utilities/version" ;
18
+ import { SwiftOutputChannel } from "../ui/SwiftOutputChannel" ;
18
19
19
20
/**
20
21
* Factory class for building LoggingDebugAdapterTracker
@@ -82,12 +83,16 @@ export class LoggingDebugAdapterTracker implements vscode.DebugAdapterTracker {
82
83
LoggingDebugAdapterTracker . debugSessionIdMap [ id ] = this ;
83
84
}
84
85
85
- static setDebugSessionCallback ( session : vscode . DebugSession , cb : ( log : string ) => void ) {
86
+ static setDebugSessionCallback (
87
+ session : vscode . DebugSession ,
88
+ outputChannel : SwiftOutputChannel ,
89
+ cb : ( log : string ) => void
90
+ ) {
86
91
const loggingDebugAdapter = this . debugSessionIdMap [ session . id ] ;
87
92
if ( loggingDebugAdapter ) {
88
93
loggingDebugAdapter . cb = cb ;
89
94
} else {
90
- console . error ( "Could not find debug adapter for session:" , session . id ) ;
95
+ outputChannel . appendLine ( "Could not find debug adapter for session: " + session . id ) ;
91
96
}
92
97
}
93
98
Original file line number Diff line number Diff line change @@ -104,7 +104,9 @@ export class TaskManager implements vscode.Disposable {
104
104
} ) ;
105
105
// setup startingTaskPromise to be resolved one task has started
106
106
if ( this . startingTaskPromise !== undefined ) {
107
- console . warn ( "TaskManager: Starting promise should be undefined if we reach here." ) ;
107
+ this . workspaceContext . outputChannel . appendLine (
108
+ "TaskManager: Starting promise should be undefined if we reach here."
109
+ ) ;
108
110
}
109
111
this . startingTaskPromise = new Promise < void > ( resolve => {
110
112
this . taskStartObserver = ( ) => {
@@ -122,7 +124,7 @@ export class TaskManager implements vscode.Disposable {
122
124
} ) ;
123
125
} ,
124
126
error => {
125
- console . log ( error ) ;
127
+ this . workspaceContext . outputChannel . appendLine ( `Error executing task: ${ error } ` ) ;
126
128
disposable . dispose ( ) ;
127
129
this . startingTaskPromise = undefined ;
128
130
reject ( error ) ;
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export class SwiftOutputChannel implements vscode.OutputChannel {
39
39
this . logStore . append ( value ) ;
40
40
41
41
if ( this . logToConsole ) {
42
+ // eslint-disable-next-line no-console
42
43
console . log ( value ) ;
43
44
}
44
45
}
@@ -48,6 +49,7 @@ export class SwiftOutputChannel implements vscode.OutputChannel {
48
49
this . logStore . appendLine ( value ) ;
49
50
50
51
if ( this . logToConsole ) {
52
+ // eslint-disable-next-line no-console
51
53
console . log ( value ) ;
52
54
}
53
55
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"rules" : {
3
+ "no-console" : " off" ,
3
4
"@typescript-eslint/no-explicit-any" : " off"
4
5
}
5
6
}
You can’t perform that action at this time.
0 commit comments