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