@@ -2,10 +2,9 @@ import * as vscode from 'vscode';
22import { run_test } from 'lib' ;
33
44export async function activate ( context : vscode . ExtensionContext ) {
5- Object . assign ( globalThis , {
5+ Object . assign ( global , {
66 readFileContent : async function ( filePath : string ) : Promise < Uint8Array > {
7- const content = await vscode . workspace . fs . readFile ( vscode . Uri . file ( filePath ) ) ;
8- return content ;
7+ return await vscode . workspace . fs . readFile ( vscode . Uri . file ( filePath ) ) ;
98 }
109 } ) ;
1110 const ctrl = vscode . tests . createTestController ( 'BasjoofanTestController' , 'Basjoofan' ) ;
@@ -65,19 +64,9 @@ export async function activate(context: vscode.ExtensionContext) {
6564 }
6665 } ;
6766
68- const appendOutput = ( chunk : string ) => {
69- for ( ; ; ) {
70- const index = chunk . indexOf ( '\n' ) ;
71- if ( index === - 1 ) break ;
72- const line = chunk . substring ( 0 , index ) ;
73- chunk = chunk . substring ( index + 1 ) ;
74- run . appendOutput ( `${ line } \r\n` ) ;
75- }
76- } ;
77-
7867 const runTestQueue = async ( ) => {
7968 for ( const test of queue ) {
80- run . appendOutput ( `Running ${ test . uri } ${ test . label } \r\n` ) ;
69+ run . appendOutput ( `Running ${ test . uri } ${ test . label } \r\n` , undefined , test ) ;
8170 if ( run . token . isCancellationRequested ) {
8271 run . skipped ( test ) ;
8372 } else {
@@ -91,6 +80,16 @@ export async function activate(context: vscode.ExtensionContext) {
9180 text += await vscode . workspace . openTextDocument ( file ) . then ( doc => doc . getText ( ) ) ;
9281 }
9382 }
83+ const appendOutput = ( chunk : string ) : void => {
84+ for ( ; ; ) {
85+ const index = chunk . indexOf ( '\n' ) ;
86+ if ( index === - 1 ) break ;
87+ const line = chunk . substring ( 0 , index ) ;
88+ chunk = chunk . substring ( index + 1 ) ;
89+ run . appendOutput ( `${ line } \r\n` , undefined , test ) ;
90+ }
91+ } ;
92+ Object . assign ( global , { appendOutput : appendOutput } ) ;
9493 const flag = await new Promise < boolean > ( resolve => {
9594 run_test ( text , test . label , workspace ! . uri . fsPath ) . then ( result => {
9695 appendOutput ( result ) ;
0 commit comments