@@ -17,7 +17,6 @@ namespace ts.projectSystem {
17
17
} ;
18
18
19
19
export interface PostExecAction {
20
- readonly requestKind : TI . RequestKind ;
21
20
readonly success : boolean ;
22
21
readonly callback : TI . RequestCompletedAction ;
23
22
}
@@ -50,9 +49,13 @@ namespace ts.projectSystem {
50
49
51
50
export class TestTypingsInstaller extends TI . TypingsInstaller implements server . ITypingsInstaller {
52
51
protected projectService : server . ProjectService ;
53
- constructor ( readonly globalTypingsCacheLocation : string , throttleLimit : number , readonly installTypingHost : server . ServerHost , log ?: TI . Log ) {
54
- super ( globalTypingsCacheLocation , safeList . path , throttleLimit , log ) ;
55
- this . init ( ) ;
52
+ constructor (
53
+ readonly globalTypingsCacheLocation : string ,
54
+ throttleLimit : number ,
55
+ installTypingHost : server . ServerHost ,
56
+ readonly typesRegistry = createMap < void > ( ) ,
57
+ log ?: TI . Log ) {
58
+ super ( installTypingHost , globalTypingsCacheLocation , safeList . path , throttleLimit , log ) ;
56
59
}
57
60
58
61
safeFileList = safeList . path ;
@@ -66,9 +69,8 @@ namespace ts.projectSystem {
66
69
}
67
70
}
68
71
69
- checkPendingCommands ( expected : TI . RequestKind [ ] ) {
70
- assert . equal ( this . postExecActions . length , expected . length , `Expected ${ expected . length } post install actions` ) ;
71
- this . postExecActions . forEach ( ( act , i ) => assert . equal ( act . requestKind , expected [ i ] , "Unexpected post install action" ) ) ;
72
+ checkPendingCommands ( expectedCount : number ) {
73
+ assert . equal ( this . postExecActions . length , expectedCount , `Expected ${ expectedCount } post install actions` ) ;
72
74
}
73
75
74
76
onProjectClosed ( p : server . Project ) {
@@ -82,15 +84,8 @@ namespace ts.projectSystem {
82
84
return this . installTypingHost ;
83
85
}
84
86
85
- executeRequest ( requestKind : TI . RequestKind , requestId : number , args : string [ ] , cwd : string , cb : TI . RequestCompletedAction ) : void {
86
- switch ( requestKind ) {
87
- case TI . NpmViewRequest :
88
- case TI . NpmInstallRequest :
89
- break ;
90
- default :
91
- assert . isTrue ( false , `request ${ requestKind } is not supported` ) ;
92
- }
93
- this . addPostExecAction ( requestKind , "success" , cb ) ;
87
+ installWorker ( requestId : number , args : string [ ] , cwd : string , cb : TI . RequestCompletedAction ) : void {
88
+ this . addPostExecAction ( "success" , cb ) ;
94
89
}
95
90
96
91
sendResponse ( response : server . SetTypings | server . InvalidateCachedTypings ) {
@@ -102,12 +97,11 @@ namespace ts.projectSystem {
102
97
this . install ( request ) ;
103
98
}
104
99
105
- addPostExecAction ( requestKind : TI . RequestKind , stdout : string | string [ ] , cb : TI . RequestCompletedAction ) {
100
+ addPostExecAction ( stdout : string | string [ ] , cb : TI . RequestCompletedAction ) {
106
101
const out = typeof stdout === "string" ? stdout : createNpmPackageJsonString ( stdout ) ;
107
102
const action : PostExecAction = {
108
103
success : ! ! out ,
109
- callback : cb ,
110
- requestKind
104
+ callback : cb
111
105
} ;
112
106
this . postExecActions . push ( action ) ;
113
107
}
0 commit comments