1
1
import { Platform , Arch , BuildInfo , PackagerOptions } from "out"
2
2
import test from "./helpers/avaEx"
3
3
import { assertPack , platform , modifyPackageJson , signed } from "./helpers/packTester"
4
- import { move , outputFile } from "fs-extra-p"
4
+ import { outputFile , rename } from "fs-extra-p"
5
5
import * as path from "path"
6
6
import { WinPackager } from "out/winPackager"
7
7
import { Promise as BluebirdPromise } from "bluebird"
@@ -48,10 +48,76 @@ test.ifNotCiOsx("nsis boring", () => assertPack("test-app-one", _signed({
48
48
}
49
49
) )
50
50
51
- // test.ifNotCiOsx("win 32", () => assertPack("test-app-one", signed({
52
- // targets: Platform.WINDOWS.createTarget(null, Arch.ia32),
53
- // })
54
- // ))
51
+ test . ifNotCiOsx ( "nsis boring" , ( ) => assertPack ( "test-app-one" , _signed ( {
52
+ targets : Platform . WINDOWS . createTarget ( [ "nsis" ] ) ,
53
+ devMetadata : {
54
+ build : {
55
+ nsis : {
56
+ oneClick : false ,
57
+ }
58
+ }
59
+ }
60
+ } ) , {
61
+ useTempDir : true ,
62
+ }
63
+ ) )
64
+
65
+ test . ifNotCiOsx ( "nsis boring, MUI_HEADER" , ( ) => {
66
+ let installerHeaderPath : string | null = null
67
+ return assertPack ( "test-app-one" , {
68
+ targets : Platform . WINDOWS . createTarget ( [ "nsis" ] ) ,
69
+ devMetadata : {
70
+ build : {
71
+ nsis : {
72
+ oneClick : false ,
73
+ }
74
+ }
75
+ } ,
76
+ effectiveOptionComputed : options => {
77
+ const defines = options [ 0 ]
78
+ assertThat ( defines . MUI_HEADERIMAGE ) . isEqualTo ( null )
79
+ assertThat ( defines . MUI_HEADERIMAGE_BITMAP ) . isEqualTo ( installerHeaderPath )
80
+ assertThat ( defines . MUI_HEADERIMAGE_RIGHT ) . isEqualTo ( null )
81
+ // speedup, do not build - another MUI_HEADER test will test build
82
+ return true
83
+ }
84
+ } , {
85
+ tempDirCreated : projectDir => {
86
+ installerHeaderPath = path . join ( projectDir , "build" , "installerHeader.bmp" )
87
+ return rename ( path . join ( projectDir , "installerHeader.bmp" ) , installerHeaderPath )
88
+ }
89
+ }
90
+ )
91
+ } )
92
+
93
+ test . ifNotCiOsx ( "nsis boring, MUI_HEADER as option" , ( ) => {
94
+ let installerHeaderPath : string | null = null
95
+ return assertPack ( "test-app-one" , {
96
+ targets : Platform . WINDOWS . createTarget ( [ "nsis" ] ) ,
97
+ devMetadata : {
98
+ build : {
99
+ nsis : {
100
+ oneClick : false ,
101
+ installerHeader : "foo.bmp"
102
+ }
103
+ }
104
+ } ,
105
+ effectiveOptionComputed : options => {
106
+ const defines = options [ 0 ]
107
+ assertThat ( defines . MUI_HEADERIMAGE ) . isEqualTo ( null )
108
+ assertThat ( defines . MUI_HEADERIMAGE_BITMAP ) . isEqualTo ( installerHeaderPath )
109
+ assertThat ( defines . MUI_HEADERIMAGE_RIGHT ) . isEqualTo ( null )
110
+ // test that we can build such installer
111
+ return false
112
+ }
113
+ } , {
114
+ tempDirCreated : projectDir => {
115
+ installerHeaderPath = path . join ( projectDir , "foo.bmp" )
116
+ return rename ( path . join ( projectDir , "installerHeader.bmp" ) , installerHeaderPath )
117
+ }
118
+ }
119
+ )
120
+ } )
55
121
56
122
// very slow
57
123
test . ifWinCi ( "delta and msi" , ( ) => assertPack ( "test-app-one" , {
@@ -95,17 +161,17 @@ test("detect install-spinner, certificateFile/password", () => {
95
161
targets : Platform . WINDOWS . createTarget ( ) ,
96
162
platformPackagerFactory : ( packager , platform , cleanupTasks ) => platformPackager = new CheckingWinPackager ( packager , cleanupTasks ) ,
97
163
devMetadata : {
98
- build : {
99
- win : {
100
- certificatePassword : "pass" ,
101
- }
164
+ build : {
165
+ win : {
166
+ certificatePassword : "pass" ,
102
167
}
103
168
}
169
+ }
104
170
} , {
105
171
tempDirCreated : it => {
106
172
loadingGifPath = path . join ( it , "build" , "install-spinner.gif" )
107
173
return BluebirdPromise . all ( [
108
- move ( path . join ( it , "install-spinner.gif" ) , loadingGifPath ) ,
174
+ rename ( path . join ( it , "install-spinner.gif" ) , loadingGifPath ) ,
109
175
modifyPackageJson ( it , data => {
110
176
data . build . win = {
111
177
certificateFile : "secretFile" ,
@@ -123,7 +189,7 @@ test("detect install-spinner, certificateFile/password", () => {
123
189
} )
124
190
125
191
test . ifNotCiOsx ( "icon < 256" , ( t : any ) => t . throws ( assertPack ( "test-app-one" , platform ( Platform . WINDOWS ) , {
126
- tempDirCreated : projectDir => move ( path . join ( projectDir , "build" , "incorrect.ico" ) , path . join ( projectDir , "build" , "icon.ico" ) , { clobber : true } )
192
+ tempDirCreated : projectDir => rename ( path . join ( projectDir , "build" , "incorrect.ico" ) , path . join ( projectDir , "build" , "icon.ico" ) )
127
193
} ) , / W i n d o w s i c o n s i z e m u s t b e a t l e a s t 2 5 6 x 2 5 6 , p l e a s e f i x " .+ / ) )
128
194
129
195
test . ifNotCiOsx ( "icon not an image" , ( t : any ) => t . throws ( assertPack ( "test-app-one" , platform ( Platform . WINDOWS ) , {
@@ -137,7 +203,7 @@ test.ifOsx("custom icon", () => {
137
203
platformPackagerFactory : ( packager , platform , cleanupTasks ) => platformPackager = new CheckingWinPackager ( packager , cleanupTasks )
138
204
} , {
139
205
tempDirCreated : projectDir => BluebirdPromise . all ( [
140
- move ( path . join ( projectDir , "build" , "icon.ico" ) , path . join ( projectDir , "customIcon.ico" ) ) ,
206
+ rename ( path . join ( projectDir , "build" , "icon.ico" ) , path . join ( projectDir , "customIcon.ico" ) ) ,
141
207
modifyPackageJson ( projectDir , data => {
142
208
data . build . win = {
143
209
icon : "customIcon"
0 commit comments