@@ -9,8 +9,16 @@ describe('Integration Ecosystem & Plugin Architecture', () => {
9
9
let pluginManager : PluginManager
10
10
let mockContext : SetupContext
11
11
let originalEnv : Record < string , string | undefined >
12
+ let originalCwd : string
12
13
13
14
beforeEach ( ( ) => {
15
+ // Store original working directory
16
+ originalCwd = process . cwd ( )
17
+
18
+ // Change to a temporary directory to avoid interference with project files
19
+ const tempDir = fs . mkdtempSync ( path . join ( require ( 'node:os' ) . tmpdir ( ) , 'plugin-test-' ) )
20
+ process . chdir ( tempDir )
21
+
14
22
pluginManager = new PluginManager ( )
15
23
mockContext = {
16
24
step : 'setup_complete' ,
@@ -73,7 +81,7 @@ describe('Integration Ecosystem & Plugin Architecture', () => {
73
81
} )
74
82
75
83
afterEach ( ( ) => {
76
- // Clean up test files
84
+ // Clean up test files in temp directory
77
85
if ( fs . existsSync ( '.buddy' ) ) {
78
86
fs . rmSync ( '.buddy' , { recursive : true , force : true } )
79
87
}
@@ -85,6 +93,15 @@ describe('Integration Ecosystem & Plugin Architecture', () => {
85
93
fs . rmSync ( file , { force : true } )
86
94
}
87
95
} )
96
+
97
+ // Restore original working directory and clean up temp directory
98
+ const tempDir = process . cwd ( )
99
+ process . chdir ( originalCwd )
100
+ try {
101
+ fs . rmSync ( tempDir , { recursive : true , force : true } )
102
+ } catch {
103
+ // Ignore cleanup errors
104
+ }
88
105
89
106
// Restore original environment variables
90
107
if ( originalEnv . SLACK_WEBHOOK_URL !== undefined ) {
@@ -287,9 +304,9 @@ describe('Integration Ecosystem & Plugin Architecture', () => {
287
304
288
305
// Test the loadCustomPlugins method directly
289
306
try {
290
- const directPlugins = await freshPluginManager . loadCustomPlugins ( )
307
+ const directPlugins = await ( freshPluginManager as any ) . loadCustomPlugins ( )
291
308
console . log ( 'Direct loadCustomPlugins result:' , directPlugins . length )
292
- directPlugins . forEach ( p => console . log ( ` Direct: ${ p . name } ` ) )
309
+ directPlugins . forEach ( ( p : any ) => console . log ( ` Direct: ${ p . name } ` ) )
293
310
}
294
311
catch ( err ) {
295
312
console . log ( 'Direct loadCustomPlugins error:' , err )
0 commit comments