@@ -4,8 +4,8 @@ const path = require("path")
4
4
const fs = require ( "fs" )
5
5
const dotenv = require ( "dotenv" )
6
6
7
- // Load test environment variables
8
- const testEnvPath = path . join ( __dirname , ".test_env" )
7
+ // Load test environment variables from root directory
8
+ const testEnvPath = path . join ( __dirname , ".." , ".." , ". test_env")
9
9
dotenv . config ( { path : testEnvPath } )
10
10
11
11
suite ( "Roo Code Extension Test Suite" , ( ) => {
@@ -114,18 +114,20 @@ suite("Roo Code Extension Test Suite", () => {
114
114
115
115
test ( "Commands should be registered" , async ( ) => {
116
116
const commands = await vscode . commands . getCommands ( true )
117
+ console . log (
118
+ "Available commands:" ,
119
+ commands . filter ( ( cmd : string ) => cmd . startsWith ( "roo-" ) ) ,
120
+ )
117
121
118
122
// Test core commands are registered
119
123
const expectedCommands = [
120
124
"roo-cline.plusButtonClicked" ,
121
125
"roo-cline.mcpButtonClicked" ,
126
+ "roo-cline.promptsButtonClicked" ,
122
127
"roo-cline.historyButtonClicked" ,
123
128
"roo-cline.popoutButtonClicked" ,
124
129
"roo-cline.settingsButtonClicked" ,
125
130
"roo-cline.openInNewTab" ,
126
- "roo-cline.explainCode" ,
127
- "roo-cline.fixCode" ,
128
- "roo-cline.improveCode" ,
129
131
]
130
132
131
133
for ( const cmd of expectedCommands ) {
@@ -206,14 +208,16 @@ suite("Roo Code Extension Test Suite", () => {
206
208
let webviewReady = false
207
209
let messagesReceived = false
208
210
const originalPostMessage = provider . postMessageToWebview . bind ( provider )
209
- // @ts -ignore
210
- provider . postMessageToWebview = async ( message ) => {
211
+ provider . postMessageToWebview = async function ( message : {
212
+ type : string
213
+ state : { codeMessages : string | any [ ] }
214
+ } ) {
211
215
if ( message . type === "state" ) {
212
216
webviewReady = true
213
217
console . log ( "Webview state received:" , message )
214
- if ( message . state ?. clineMessages ?. length > 0 ) {
218
+ if ( message . state ?. codeMessages ?. length > 0 ) {
215
219
messagesReceived = true
216
- console . log ( "Messages in state:" , message . state . clineMessages )
220
+ console . log ( "Messages in state:" , message . state . codeMessages )
217
221
}
218
222
}
219
223
await originalPostMessage ( message )
@@ -268,18 +272,6 @@ suite("Roo Code Extension Test Suite", () => {
268
272
throw error
269
273
}
270
274
271
- // Wait for task to appear in history with tokens
272
- startTime = Date . now ( )
273
- while ( Date . now ( ) - startTime < timeout ) {
274
- const state = await provider . getState ( )
275
- const task = state . taskHistory ?. [ 0 ]
276
- if ( task && task . tokensOut > 0 ) {
277
- console . log ( "Task completed with tokens:" , task )
278
- break
279
- }
280
- await new Promise ( ( resolve ) => setTimeout ( resolve , interval ) )
281
- }
282
-
283
275
// Wait for messages to be processed
284
276
startTime = Date . now ( )
285
277
let responseReceived = false
@@ -288,29 +280,27 @@ suite("Roo Code Extension Test Suite", () => {
288
280
const messages = provider . clineMessages
289
281
if ( messages && messages . length > 0 ) {
290
282
console . log ( "Provider messages:" , JSON . stringify ( messages , null , 2 ) )
291
- // @ts -ignore
292
283
const hasResponse = messages . some (
293
284
( m : { type : string ; text : string } ) =>
294
- m . type === "say" && m . text && m . text . toLowerCase ( ) . includes ( "cline " ) ,
285
+ m . type === "say" && m . text && m . text . toLowerCase ( ) . includes ( "roo " ) ,
295
286
)
296
287
if ( hasResponse ) {
297
- console . log ( 'Found response containing "Cline " in provider messages' )
288
+ console . log ( 'Found response containing "Roo " in provider messages' )
298
289
responseReceived = true
299
290
break
300
291
}
301
292
}
302
293
303
- // Check provider.cline.clineMessages
294
+ //Check provider.cline.clineMessages
304
295
const clineMessages = provider . cline ?. clineMessages
305
296
if ( clineMessages && clineMessages . length > 0 ) {
306
297
console . log ( "Cline messages:" , JSON . stringify ( clineMessages , null , 2 ) )
307
- // @ts -ignore
308
298
const hasResponse = clineMessages . some (
309
299
( m : { type : string ; text : string } ) =>
310
- m . type === "say" && m . text && m . text . toLowerCase ( ) . includes ( "cline " ) ,
300
+ m . type === "say" && m . text && m . text . toLowerCase ( ) . includes ( "roo " ) ,
311
301
)
312
302
if ( hasResponse ) {
313
- console . log ( 'Found response containing "Cline " in cline messages' )
303
+ console . log ( 'Found response containing "Roo " in cline messages' )
314
304
responseReceived = true
315
305
break
316
306
}
@@ -321,8 +311,7 @@ suite("Roo Code Extension Test Suite", () => {
321
311
322
312
if ( ! responseReceived ) {
323
313
console . log ( "Final provider state:" , await provider . getState ( ) )
324
- console . log ( "Final cline messages:" , provider . cline ?. clineMessages )
325
- throw new Error ( 'Did not receive expected response containing "Cline"' )
314
+ throw new Error ( "Did not receive any response" )
326
315
}
327
316
} finally {
328
317
panel . dispose ( )
0 commit comments