File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,40 @@ async function Utg(context: vscode.ExtensionContext , additional_prompts?:string
267267 return ;
268268 }
269269
270- // ... rest of the existing code ...
270+ console . log ( "additional_prompts" , additional_prompts ) ;
271+ if ( ! additional_prompts ) {
272+ additional_prompts = "" ;
273+ }
274+
275+ // Adjust the terminal command to include the test file path
276+ terminal . sendText ( `sh "${ scriptPath } " "${ sourceFilePath } " "${ testFilePaths [ 0 ] } " "${ coverageReportPath } " "${ command } " "${ additional_prompts } ";` ) ;
277+
278+ const delay = ( ms : number ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
279+
280+ // Add a 5-second delay before calling the API
281+ await delay ( 5000 ) ;
282+
283+ try {
284+ if ( token ) {
285+ apiResponse = await makeApiRequest ( token ) || 'no response' ;
286+ const response = JSON . parse ( apiResponse ) ;
287+ await context . globalState . update ( 'apiResponse' , apiResponse ) ;
288+ if ( response . usedCall === response . totalCall ) {
289+ await context . globalState . update ( 'SubscriptionEnded' , true ) ;
290+ }
291+ } else {
292+ console . log ( "token not found" ) ;
293+ }
294+ } catch ( apiError ) {
295+ vscode . window . showErrorMessage ( 'Error during API request: ' + apiError ) ;
296+ }
297+
298+ const disposable = vscode . window . onDidCloseTerminal ( eventTerminal => {
299+ if ( eventTerminal === terminal ) {
300+ disposable . dispose ( ) ;
301+ resolve ( ) ;
302+ }
303+ } ) ;
271304 } catch ( error ) {
272305 console . log ( error ) ;
273306 vscode . window . showErrorMessage ( 'Error occurred Keploy utg: ' + error ) ;
You can’t perform that action at this time.
0 commit comments