@@ -15,38 +15,33 @@ import { NodeModulesEngineHost } from './node-module-engine-host';
1515 * revert back to using node modules resolution. This is done for testing.
1616 */
1717export class NodeModulesTestEngineHost extends NodeModulesEngineHost {
18- private _collections = new Map < string , string > ( ) ;
19- private _tasks = [ ] as TaskConfiguration [ ] ;
18+ #collections = new Map < string , string > ( ) ;
19+ #tasks: TaskConfiguration [ ] = [ ] ;
2020
2121 get tasks ( ) {
22- return this . _tasks ;
22+ return this . #tasks ;
2323 }
2424
2525 clearTasks ( ) {
26- this . _tasks = [ ] ;
26+ this . #tasks = [ ] ;
2727 }
2828
2929 registerCollection ( name : string , path : string ) {
30- this . _collections . set ( name , path ) ;
30+ this . #collections . set ( name , path ) ;
3131 }
3232
3333 override transformContext ( context : FileSystemSchematicContext ) : FileSystemSchematicContext {
34- const oldAddTask = context . addTask ;
35- context . addTask = ( task : TaskConfigurationGenerator < { } > , dependencies ?: Array < TaskId > ) => {
36- this . _tasks . push ( task . toConfiguration ( ) ) ;
34+ const oldAddTask = context . addTask . bind ( context ) ;
35+ context . addTask = ( task : TaskConfigurationGenerator , dependencies ?: TaskId [ ] ) => {
36+ this . #tasks . push ( task . toConfiguration ( ) ) ;
3737
38- return oldAddTask . call ( context , task , dependencies ) ;
38+ return oldAddTask ( task , dependencies ) ;
3939 } ;
4040
4141 return context ;
4242 }
4343
4444 protected override _resolveCollectionPath ( name : string , requester ?: string ) : string {
45- const maybePath = this . _collections . get ( name ) ;
46- if ( maybePath ) {
47- return maybePath ;
48- }
49-
50- return super . _resolveCollectionPath ( name , requester ) ;
45+ return this . #collections. get ( name ) ?? super . _resolveCollectionPath ( name , requester ) ;
5146 }
5247}
0 commit comments