File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ import {FakeCliFs} from "./FakeCliFs.js";
2828import { FakeCliHttpClient } from "./FakeCliHttpClient.js" ;
2929
3030export class CliPlatformTest extends DITest {
31+ static async reset ( ) {
32+ // Explicitly clear FakeCliFs static collections to prevent memory leaks
33+ FakeCliFs . files . clear ( ) ;
34+ FakeCliFs . directories . clear ( ) ;
35+ FakeCliExeca . entries . clear ( ) ;
36+ FakeCliHttpClient . entries . clear ( ) ;
37+ // Call parent reset method
38+ return super . reset ( ) ;
39+ }
40+
3141 static async bootstrap ( options : Partial < TsED . Configuration > = { } ) {
3242 options = resolveConfiguration ( {
3343 name : "tsed" ,
Original file line number Diff line number Diff line change @@ -297,11 +297,6 @@ export class FakeCliFs implements FileSystemHost {
297297 return matchGlobs ( allFilePaths , patterns , this . getCurrentDirectory ( ) ) ;
298298 }
299299
300- $onDestroy ( ) {
301- FakeCliFs . files . clear ( ) ;
302- FakeCliFs . directories . clear ( ) ;
303- }
304-
305300 private normalizePath ( path : any ) : string {
306301 return ( normalizePath ( path ) as string ) . replace ( / ^ \/ / , "" ) as string ;
307302 }
Original file line number Diff line number Diff line change 11import { CliHttpClient , type CliHttpClientOptions } from "@tsed/cli-core" ;
2- import type { OnDestroy } from "@tsed/di" ;
32
4- export class FakeCliHttpClient extends CliHttpClient implements OnDestroy {
3+ export class FakeCliHttpClient extends CliHttpClient {
54 static entries = new Map < string , ( endpoint : string , options : CliHttpClientOptions ) => any > ( ) ;
65
76 get ( endpoint : string , options : CliHttpClientOptions = { } ) : Promise < any > {
@@ -21,8 +20,4 @@ export class FakeCliHttpClient extends CliHttpClient implements OnDestroy {
2120
2221 return FakeCliHttpClient . entries . get ( key ) ?.( endpoint , options ) ;
2322 }
24-
25- $onDestroy ( ) {
26- FakeCliHttpClient . entries . clear ( ) ;
27- }
2823}
You can’t perform that action at this time.
0 commit comments