@@ -6,16 +6,22 @@ import * as assert from 'assert';
66import * as vscode from 'vscode' ;
77import * as fs from "fs" ;
88
9+ function prepareTargetFolder ( inTarget )
10+ {
11+ if ( fs . existsSync ( inTarget ) ) {
12+ fs . rmSync ( inTarget , { recursive :true } ) ;
13+ }
14+ fs . mkdirSync ( inTarget ) ;
15+ }
16+
917//https://resources-download.4d.com/release/20.x/latest/latest/win/tool4d_win.tar.xz?debug
1018suite ( 'Download tool' , ( ) => {
1119 const downloadPath = getDocPath ( "Download" ) ;
12- if ( fs . existsSync ( downloadPath ) ) {
13- fs . rmSync ( downloadPath , { recursive :true } ) ;
14- }
15- fs . mkdirSync ( downloadPath ) ;
1620
1721 const ext = vscode . extensions . getExtension ( '4D.4d-analyzer' ) ! ;
1822 test ( 'Tool download stable' , async ( ) => {
23+ prepareTargetFolder ( downloadPath ) ;
24+
1925 let number = 21 ;
2026 await ext . activate ( ) ;
2127
@@ -41,8 +47,9 @@ suite('Download tool', () => {
4147 }
4248 await testDownloadLTS ( downloadPath , lastVersionAvailable , "stable" ) ;
4349 } ) ;
44-
4550 test ( 'Tool download beta' , async ( ) => {
51+ prepareTargetFolder ( downloadPath ) ;
52+
4653 let number = 21 ;
4754 await ext . activate ( ) ;
4855
@@ -61,7 +68,6 @@ suite('Download tool', () => {
6168 const lastVersionAvailable = await requestLabelVersion ( `https://resources-download.4d.com/release/${ number } Rx/latest/latest/win/tool4d_win.tar.xz?channel=beta` , "beta" )
6269 lastVersionAvailable . changelist = 0 ;
6370
64-
6571 await testDownloadR ( downloadPath , lastVersionAvailable , "beta" ) ;
6672 if ( lastVersionAvailable . releaseVersion >= 2 ) {
6773 await testDownloadRVersion ( downloadPath , lastVersionAvailable , "beta" ) ;
@@ -82,8 +88,7 @@ async function testDownloadR(downloadPath: string, labeledVersion: LabeledVersio
8288 assert ( result . currentVersion . releaseVersion === labeledVersion . releaseVersion ) ;
8389 assert ( result . currentVersion . changelist > 0 ) ;
8490 } catch ( e ) {
85- console . log ( "ERROR" , e ) ;
86- assert ( false ) ;
91+ assert ( false , e ) ;
8792 }
8893 }
8994 else //If We are a 20R2
@@ -93,7 +98,7 @@ async function testDownloadR(downloadPath: string, labeledVersion: LabeledVersio
9398 const result = await toolPreparator . prepareLastToolWithoutProgress ( downloadPath , false ) ;
9499 assert ( false ) ;
95100 } catch ( e ) {
96- assert ( true ) ;
101+ assert ( true , e ) ;
97102 }
98103 }
99104}
@@ -107,7 +112,7 @@ async function testDownloadRVersion(downloadPath: string, labeledVersion: Labele
107112 assert ( result . currentVersion . releaseVersion === labeledVersion . releaseVersion ) ;
108113 assert ( result . currentVersion . changelist > 0 ) ;
109114 } catch ( e ) {
110- assert ( false ) ;
115+ assert ( false , e ) ;
111116 }
112117}
113118
@@ -121,7 +126,7 @@ async function testDownloadLTS(downloadPath: string, labeledVersion: LabeledVers
121126 assert ( result . currentVersion . releaseVersion === 0 ) ;
122127 assert ( result . currentVersion . changelist > 0 ) ;
123128 } catch ( e ) {
124- assert ( false ) ;
129+ assert ( false , e ) ;
125130 }
126131 }
127132 else //If We are a 20R2
0 commit comments