3
3
4
4
import * as path from "path" ;
5
5
import * as vscode from "vscode" ;
6
+ import { ILogger } from "../src/logging" ;
6
7
import { IPowerShellExtensionClient } from "../src/features/ExternalApi" ;
7
8
8
9
// This lets us test the rest of our path assumptions against the baseline of
@@ -12,6 +13,46 @@ export const rootPath = path.resolve(__dirname, "../../");
12
13
const packageJSON : any = require ( path . resolve ( rootPath , "package.json" ) ) ;
13
14
export const extensionId = `${ packageJSON . publisher } .${ packageJSON . name } ` ;
14
15
16
+ export class TestLogger implements ILogger {
17
+ getLogFilePath ( _baseName : string ) : vscode . Uri {
18
+ return vscode . Uri . file ( "" ) ;
19
+ }
20
+ updateLogLevel ( _logLevelName : string ) : void {
21
+ return ;
22
+ }
23
+ write ( _message : string , ..._additionalMessages : string [ ] ) : void {
24
+ return ;
25
+ }
26
+ writeAndShowInformation ( _message : string , ..._additionalMessages : string [ ] ) : Promise < void > {
27
+ return Promise . resolve ( ) ;
28
+ }
29
+ writeDiagnostic ( _message : string , ..._additionalMessages : string [ ] ) : void {
30
+ return ;
31
+ }
32
+ writeVerbose ( _message : string , ..._additionalMessages : string [ ] ) : void {
33
+ return ;
34
+ }
35
+ writeWarning ( _message : string , ..._additionalMessages : string [ ] ) : void {
36
+ return ;
37
+ }
38
+ writeAndShowWarning ( _message : string , ..._additionalMessages : string [ ] ) : Promise < void > {
39
+ return Promise . resolve ( ) ;
40
+ }
41
+ writeError ( _message : string , ..._additionalMessages : string [ ] ) : void {
42
+ return ;
43
+ }
44
+ writeAndShowError ( _message : string , ..._additionalMessages : string [ ] ) : Promise < void > {
45
+ return Promise . resolve ( ) ;
46
+ }
47
+ writeAndShowErrorWithActions (
48
+ _message : string ,
49
+ _actions : { prompt : string ; action : ( ( ) => Promise < void > ) | undefined } [ ] ) : Promise < void > {
50
+ return Promise . resolve ( ) ;
51
+ }
52
+ }
53
+
54
+ export const testLogger = new TestLogger ( ) ;
55
+
15
56
export async function ensureExtensionIsActivated ( ) : Promise < IPowerShellExtensionClient > {
16
57
const extension = vscode . extensions . getExtension ( extensionId ) ;
17
58
if ( ! extension ! . isActive ) { await extension ! . activate ( ) ; }
0 commit comments