6
6
import { Application , ApplicationOptions , Quality } from '../../../../automation' ;
7
7
import { join } from 'path' ;
8
8
import { ParsedArgs } from 'minimist' ;
9
- import { timeout } from '../../utils' ;
9
+ import { afterSuite , timeout } from '../../utils' ;
10
10
11
11
export function setup ( opts : ParsedArgs , testDataPath : string ) {
12
12
13
13
describe ( 'Datamigration' , ( ) => {
14
+
15
+ let insidersApp : Application | undefined = undefined ;
16
+ let stableApp : Application | undefined = undefined ;
17
+
18
+ afterSuite ( opts , ( ) => insidersApp , async ( ) => stableApp ?. stop ( ) ) ;
19
+
14
20
it ( `verifies opened editors are restored` , async function ( ) {
15
21
const stableCodePath = opts [ 'stable-build' ] ;
16
22
if ( ! stableCodePath ) {
@@ -31,7 +37,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
31
37
stableOptions . userDataDir = userDataDir ;
32
38
stableOptions . quality = Quality . Stable ;
33
39
34
- const stableApp = new Application ( stableOptions ) ;
40
+ stableApp = new Application ( stableOptions ) ;
35
41
await stableApp . start ( ) ;
36
42
37
43
// Open 3 editors and pin 2 of them
@@ -44,11 +50,12 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
44
50
await stableApp . workbench . editors . newUntitledFile ( ) ;
45
51
46
52
await stableApp . stop ( ) ;
53
+ stableApp = undefined ;
47
54
48
55
const insiderOptions : ApplicationOptions = Object . assign ( { } , this . defaultOptions ) ;
49
56
insiderOptions . userDataDir = userDataDir ;
50
57
51
- const insidersApp = new Application ( insiderOptions ) ;
58
+ insidersApp = new Application ( insiderOptions ) ;
52
59
await insidersApp . start ( ) ;
53
60
54
61
// Verify 3 editors are open
@@ -57,6 +64,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
57
64
await insidersApp . workbench . editors . selectTab ( 'www' ) ;
58
65
59
66
await insidersApp . stop ( ) ;
67
+ insidersApp = undefined ;
60
68
} ) ;
61
69
62
70
it ( `verifies that 'hot exit' works for dirty files` , async function ( ) {
@@ -72,7 +80,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
72
80
stableOptions . userDataDir = userDataDir ;
73
81
stableOptions . quality = Quality . Stable ;
74
82
75
- const stableApp = new Application ( stableOptions ) ;
83
+ stableApp = new Application ( stableOptions ) ;
76
84
await stableApp . start ( ) ;
77
85
78
86
await stableApp . workbench . editors . newUntitledFile ( ) ;
@@ -89,11 +97,12 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
89
97
await timeout ( 2000 ) ; // give time to store the backup before stopping the app
90
98
91
99
await stableApp . stop ( ) ;
100
+ stableApp = undefined ;
92
101
93
102
const insiderOptions : ApplicationOptions = Object . assign ( { } , this . defaultOptions ) ;
94
103
insiderOptions . userDataDir = userDataDir ;
95
104
96
- const insidersApp = new Application ( insiderOptions ) ;
105
+ insidersApp = new Application ( insiderOptions ) ;
97
106
await insidersApp . start ( ) ;
98
107
99
108
await insidersApp . workbench . editors . waitForTab ( readmeMd , true ) ;
@@ -105,6 +114,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) {
105
114
await insidersApp . workbench . editor . waitForEditorContents ( untitled , c => c . indexOf ( textToTypeInUntitled ) > - 1 ) ;
106
115
107
116
await insidersApp . stop ( ) ;
117
+ insidersApp = undefined ;
108
118
} ) ;
109
119
} ) ;
110
120
}
0 commit comments