Skip to content

Commit

Permalink
test: prepackaged asar electron-userland#1102
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Feb 3, 2017
1 parent 6c977c4 commit ea73196
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/programmaticUsage.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict"

const builder = require("electron-builder")
const Platform = builder.Platform

// Promise is returned
builder.build({
platform: [builder.Platform.MAC],
"//": "platform, arch and other properties, see PackagerOptions in the node_modules/electron-builder/out/electron-builder.d.ts",
targets: Platform.MAC.createTarget(),
config: {
"//": "build options, see https://goo.gl/ZhRfla"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"source-map-support": "^0.4.11",
"ts-babel": "^1.3.5",
"tslint": "^4.4.2",
"typescript": "^2.1.5",
"typescript": "^2.2.0",
"whitespace": "^2.1.0"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-http/src/httpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export abstract class HttpExecutor<REQUEST_OPTS, REQUEST> {
try {
const contentType = response.headers["content-type"]
const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes("json")) != null : contentType.includes("json"))
if (response.statusCode >= 400) {
if (response.statusCode != null && response.statusCode >= 400) {
reject(new HttpError(response, isJson ? JSON.parse(data) : data))
}
else {
Expand Down
25 changes: 20 additions & 5 deletions test/src/linux/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { modifyPackageJson, app, appThrows } from "../helpers/packTester"
import { remove, readFile } from "fs-extra-p"
import { remove, readFile, rename } from "fs-extra-p"
import * as path from "path"
import { Platform } from "electron-builder"
import { Platform, build } from "electron-builder"
import { assertThat } from "../helpers/fileAssert"

test.ifDevOrLinuxCi("AppImage", app({targets: Platform.LINUX.createTarget()}))

test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom desktop", app({
targets: Platform.LINUX.createTarget("appimage"),
effectiveOptionComputed: async (it) => {
const content = await readFile(it[1], "utf-8")
expect (content.includes("Foo=bar")).toBeTruthy()
expect (content.includes("Terminal=true")).toBeTruthy()
expect(content.includes("Foo=bar")).toBeTruthy()
expect(content.includes("Terminal=true")).toBeTruthy()
return false
},
config: {
Expand All @@ -27,7 +28,21 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt
}))

test.ifNotWindows("icons from ICNS", app({targets: Platform.LINUX.createTarget()}, {
projectDirCreated: it => remove(path.join(it, "build", "icons"))
projectDirCreated: it => remove(path.join(it, "build", "icons")),
packed: async context => {
// test https://github.com/electron-userland/electron-builder/issues/1102
const projectDir = context.getResources(Platform.LINUX)

await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar"))

await build({
targets: Platform.LINUX.createTarget(),
projectDir: projectDir,
})

await assertThat(path.join(projectDir, "dist")).isDirectory()
await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile()
},
}))

test.ifNotWindows("no-author-email", appThrows(/Please specify author 'email' in .+/, {targets: Platform.LINUX.createTarget("deb")}, {
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2776,8 +2776,8 @@ type-check@~0.3.2:
prelude-ls "~1.1.2"

typescript@^2.1.5:
version "2.1.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.5.tgz#6fe9479e00e01855247cea216e7561bafcdbcd4a"
version "2.2.0"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.0.tgz#626f2fc70087d2480f21ebb12c1888288c8614e3"

uc.micro@^1.0.1, uc.micro@^1.0.3:
version "1.0.3"
Expand Down

0 comments on commit ea73196

Please sign in to comment.