-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathdebTest.ts
119 lines (112 loc) · 2.83 KB
/
debTest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import { Arch, Platform } from "electron-builder"
import * as fs from "fs/promises"
import { app, execShell, getTarExecutable } from "../helpers/packTester"
test.ifNotWindows(
"deb",
app({
targets: Platform.LINUX.createTarget("deb"),
})
)
test.ifNotWindows("arm", app({ targets: Platform.LINUX.createTarget("deb", Arch.armv7l, Arch.arm64) }))
test.ifNotWindows(
"custom depends",
app({
targets: Platform.LINUX.createTarget("deb"),
config: {
linux: {
executableName: "Boo",
},
deb: {
depends: ["foo"],
},
electronFuses: {
runAsNode: true,
enableCookieEncryption: true,
enableNodeOptionsEnvironmentVariable: true,
enableNodeCliInspectArguments: true,
enableEmbeddedAsarIntegrityValidation: true,
onlyLoadAppFromAsar: true,
loadBrowserProcessSpecificV8Snapshot: true,
grantFileProtocolExtraPrivileges: undefined, // unsupported on current electron version in our tests
},
},
})
)
test.ifNotWindows(
"top-level exec name",
app({
targets: Platform.LINUX.createTarget("deb"),
config: {
productName: "foo",
executableName: "Boo",
},
})
)
test.ifNotWindows(
"no quotes for safe exec name",
app({
targets: Platform.LINUX.createTarget("deb"),
config: {
productName: "foo",
linux: {
executableName: "Boo",
},
},
effectiveOptionComputed: async it => {
const content = await fs.readFile(it[1], "utf8")
expect(content).toMatchSnapshot()
return false
},
})
)
test.ifNotWindows.ifAll(
"executable path in postinst script",
app(
{
targets: Platform.LINUX.createTarget("deb"),
config: {
productName: "foo",
linux: {
executableName: "Boo",
},
},
},
{
packed: async context => {
const postinst = (
await execShell(`ar p '${context.outDir}/TestApp_1.1.0_amd64.deb' control.tar.gz | ${await getTarExecutable()} zx --to-stdout ./postinst`, {
maxBuffer: 10 * 1024 * 1024,
})
).stdout
expect(postinst.trim()).toMatchSnapshot()
},
}
)
)
test.ifNotWindows.ifAll(
"deb file associations",
app(
{
targets: Platform.LINUX.createTarget("deb"),
config: {
fileAssociations: [
{
ext: "my-app",
name: "Test Foo",
mimeType: "application/x-example",
},
],
},
},
{
packed: async context => {
const mime = (
await execShell(`ar p '${context.outDir}/TestApp_1.1.0_amd64.deb' data.tar.xz | ${await getTarExecutable()} Jx --to-stdout ./usr/share/mime/packages/testapp.xml`, {
maxBuffer: 10 * 1024 * 1024,
})
).stdout
expect(mime.trim()).toMatchSnapshot()
},
}
)
)