diff --git a/docker/test.sh b/docker/test.sh index 150d0589c3d..120220d4a0b 100755 --- a/docker/test.sh +++ b/docker/test.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e npm install npm prune diff --git a/package.json b/package.json index 72561493070..ac38d20c889 100644 --- a/package.json +++ b/package.json @@ -64,9 +64,9 @@ "compare-versions": "^2.0.1", "debug": "^2.2.0", "deep-assign": "^2.0.0", - "electron-osx-sign-tf": "0.5.1", - "electron-packager-tf": "~7.2.0", - "electron-winstaller-fixed": "~2.9.3", + "electron-osx-sign-tf": "0.6.0", + "electron-packager-tf": "~7.3.0", + "electron-winstaller-fixed": "~2.9.4", "fs-extra-p": "^1.0.1", "globby": "^4.1.0", "hosted-git-info": "^2.1.5", diff --git a/src/osxPackager.ts b/src/osxPackager.ts index 66a10cae36c..57aa05edb05 100644 --- a/src/osxPackager.ts +++ b/src/osxPackager.ts @@ -5,7 +5,7 @@ import { Promise as BluebirdPromise } from "bluebird" import { log, debug, warn, isEmptyOrSpaces } from "./util" import { createKeychain, deleteKeychain, CodeSigningInfo, generateKeychainName, findIdentity } from "./codeSign" import deepAssign = require("deep-assign") -import { sign, flat, BaseSignOptions, SignOptions, FlatOptions } from "electron-osx-sign-tf" +import { signAsync, flatAsync, BaseSignOptions, SignOptions, FlatOptions } from "electron-osx-sign-tf" //noinspection JSUnusedLocalSymbols const __awaiter = require("./awaiter") @@ -134,6 +134,7 @@ export default class OsXPackager extends PlatformPackager { app: path.join(appOutDir, `${this.appName}.app`), platform: masOptions == null ? "darwin" : "mas", keychain: codeSigningInfo.keychainName, + version: this.info.electronVersion } const signOptions = Object.assign({ @@ -176,11 +177,11 @@ export default class OsXPackager extends PlatformPackager { } protected async doSign(opts: SignOptions): Promise { - return BluebirdPromise.promisify(sign)(opts) + return signAsync(opts) } protected async doFlat(opts: FlatOptions): Promise { - return BluebirdPromise.promisify(flat)(opts) + return flatAsync(opts) } protected async computeEffectiveDistOptions(appOutDir: string): Promise { diff --git a/src/winPackager.ts b/src/winPackager.ts index 3926631c111..62f7d3c64a1 100644 --- a/src/winPackager.ts +++ b/src/winPackager.ts @@ -140,6 +140,7 @@ export class WinPackager extends PlatformPackager { usePackageJson: false, extraMetadataSpecs: projectUrl == null ? null : `\n ${projectUrl}`, copyright: packOptions["app-copyright"], + packageCompressionLevel: this.devMetadata.build.compression === "store" ? 0 : 9, sign: { name: this.appName, site: projectUrl, diff --git a/test/fixtures/test-app-one/package.json b/test/fixtures/test-app-one/package.json index becb89c8939..e485c9b305d 100755 --- a/test/fixtures/test-app-one/package.json +++ b/test/fixtures/test-app-one/package.json @@ -10,7 +10,7 @@ "author": "Foo Bar ", "license": "MIT", "devDependencies": { - "electron-prebuilt": "^0.37.8" + "electron-prebuilt": "^1.2.1" }, "build": { "app-bundle-id": "your.id", diff --git a/test/fixtures/test-app/package.json b/test/fixtures/test-app/package.json index 2cfe0c21252..9123d6acc14 100755 --- a/test/fixtures/test-app/package.json +++ b/test/fixtures/test-app/package.json @@ -4,7 +4,7 @@ "start": "electron ." }, "devDependencies": { - "electron-prebuilt": "^0.37.8" + "electron-prebuilt": "^1.2.1" }, "build": { "app-bundle-id": "your.id", diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts index 6fa9a0d378d..b3d03a95416 100755 --- a/test/src/BuildTest.ts +++ b/test/src/BuildTest.ts @@ -6,9 +6,9 @@ import { Promise as BluebirdPromise } from "bluebird" import * as path from "path" import { assertThat } from "./helpers/fileAssert" import { archFromString, BuildOptions, Platform, Arch, PackagerOptions, DIR_TARGET, createTargets } from "out" -import pathSorter = require("path-sort") import { normalizeOptions } from "out/builder" import { createYargs } from "out/cliOptions" +import pathSorter = require("path-sort") //noinspection JSUnusedLocalSymbols const __awaiter = require("out/awaiter") @@ -128,7 +128,7 @@ test("relative index", () => assertPack("test-app", allPlatforms(false), { }, true) })) -const electronVersion = "0.37.8" +const electronVersion = "1.2.1" test.ifNotWindows("electron version from electron-prebuilt dependency", () => assertPack("test-app-one", { targets: Platform.LINUX.createTarget(DIR_TARGET), diff --git a/test/src/helpers/expectedContents.ts b/test/src/helpers/expectedContents.ts index 62e68c10110..86dce7a8d9a 100755 --- a/test/src/helpers/expectedContents.ts +++ b/test/src/helpers/expectedContents.ts @@ -65,15 +65,12 @@ export const expectedWinContents = [ "lib/net45/libGLESv2.dll", "lib/net45/LICENSE", "lib/net45/LICENSES.chromium.html", - "lib/net45/msvcp120.dll", - "lib/net45/msvcr120.dll", "lib/net45/natives_blob.bin", "lib/net45/node.dll", "lib/net45/snapshot_blob.bin", "lib/net45/TestApp.exe", "lib/net45/ui_resources_200_percent.pak", "lib/net45/Update.exe", - "lib/net45/vccorlib120.dll", "lib/net45/version", "lib/net45/xinput1_3.dll", "lib/net45/locales/en-US.pak", diff --git a/test/src/helpers/fileAssert.ts b/test/src/helpers/fileAssert.ts index 8f19e26f580..893f7f2a895 100644 --- a/test/src/helpers/fileAssert.ts +++ b/test/src/helpers/fileAssert.ts @@ -3,6 +3,7 @@ import * as json8 from "json8" import { green, red, gray } from "chalk" import { diffJson } from "diff" import { AssertionError } from "assert" +import * as path from "path" //noinspection JSUnusedLocalSymbols const __awaiter = require("out/awaiter") @@ -31,6 +32,12 @@ class Assertions { } } + isAbsolute() { + if (!path.isAbsolute(this.actual)) { + throw new Error(`Path ${this.actual} is not absolute`) + } + } + async isFile() { const info = await stat(this.actual) if (!info.isFile()) { diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index b800f51af28..9e4a48d4c13 100755 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -1,5 +1,6 @@ import { copy, emptyDir, remove, writeJson, readJson, readFile } from "fs-extra-p" -import * as assertThat from "should/as-function" +import * as assertThat2 from "should/as-function" +import { assertThat } from "./fileAssert" import * as path from "path" import { parse as parsePlist } from "plist" import { CSC_LINK, CSC_KEY_PASSWORD, CSC_INSTALLER_LINK, CSC_INSTALLER_KEY_PASSWORD } from "./codeSignData" @@ -7,9 +8,9 @@ import { expectedLinuxContents, expectedWinContents } from "./expectedContents" import { Packager, PackagerOptions, Platform, getProductName, ArtifactCreated, Arch, DIR_TARGET } from "out" import { exec, getTempName } from "out/util" import { tmpdir } from "os" -import DecompressZip = require("decompress-zip") import { getArchSuffix } from "out/platformPackager" import pathSorter = require("path-sort") +import DecompressZip = require("decompress-zip") //noinspection JSUnusedLocalSymbols const __awaiter = require("out/awaiter") @@ -83,7 +84,7 @@ async function packAndCheck(projectDir: string, packagerOptions: PackagerOptions const artifacts: Map> = new Map() packager.artifactCreated(event => { - assertThat(path.isAbsolute(event.file)).true() + assertThat(event.file).isAbsolute() let list = artifacts.get(event.platform) if (list == null) { list = [] @@ -129,7 +130,7 @@ async function checkLinuxResult(projectDir: string, packager: Packager, checkOpt return result } - assertThat(getFileNames(artifacts)).deepEqual((checkOptions == null || checkOptions.expectedArtifacts == null ? getExpected() : checkOptions.expectedArtifacts.slice()).sort()) + assertThat(getFileNames(artifacts)).isEqualTo((checkOptions == null || checkOptions.expectedArtifacts == null ? getExpected() : checkOptions.expectedArtifacts.slice()).sort()) if (!targets.includes("deb") || !targets.includes("default")) { return @@ -152,12 +153,12 @@ async function checkLinuxResult(projectDir: string, packager: Packager, checkOpt // console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2)) const packageFile = `${projectDir}/${outDirName}/TestApp-1.1.0-amd64.deb` - assertThat(await getContents(packageFile, productName)).deepEqual(expectedContents) + assertThat(await getContents(packageFile, productName)).isEqualTo(expectedContents) if (arch === Arch.ia32) { - assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-1.1.0-i386.deb`, productName)).deepEqual(expectedContents) + assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-1.1.0-i386.deb`, productName)).isEqualTo(expectedContents) } - assertThat(parseDebControl(await exec("dpkg", ["--info", packageFile]))).has.properties({ + assertThat2(parseDebControl(await exec("dpkg", ["--info", packageFile]))).has.properties({ License: "MIT", Homepage: "http://foo.example.com", Maintainer: "Foo Bar ", @@ -191,7 +192,7 @@ async function checkOsXResult(packager: Packager, packagerOptions: PackagerOptio const productName = getProductName(packager.metadata, packager.devMetadata) const packedAppDir = path.join(path.dirname(artifacts[0].file), (productName || packager.metadata.name) + ".app") const info = parsePlist(await readFile(path.join(packedAppDir, "Contents", "Info.plist"), "utf8")) - assertThat(info).has.properties({ + assertThat2(info).has.properties({ CFBundleDisplayName: productName, CFBundleIdentifier: "your.id", LSApplicationCategoryType: "your.app.category.type", @@ -200,20 +201,20 @@ async function checkOsXResult(packager: Packager, packagerOptions: PackagerOptio if (packagerOptions.cscLink != null) { const result = await exec("codesign", ["--verify", packedAppDir]) - assertThat(result).not.match(/is not signed at all/) + assertThat2(result).not.match(/is not signed at all/) } const actualFiles = artifacts.map(it => path.basename(it.file)).sort() if (checkOptions != null && checkOptions.expectedContents != null) { - assertThat(actualFiles).deepEqual(checkOptions.expectedContents) + assertThat(actualFiles).isEqualTo(checkOptions.expectedContents) } else { - assertThat(actualFiles).deepEqual([ + assertThat(actualFiles).isEqualTo([ `${productName}-1.1.0-mac.zip`, `${productName}-1.1.0.dmg`, ].sort()) - assertThat(artifacts.map(it => it.artifactName).sort()).deepEqual([ + assertThat(artifacts.map(it => it.artifactName).sort()).isEqualTo([ "TestApp-1.1.0-mac.zip", "TestApp-1.1.0.dmg", ].sort()) @@ -241,13 +242,13 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp } const archSuffix = getArchSuffix(arch) - assertThat(getFileNames(artifacts)).deepEqual((checkOptions == null || checkOptions.expectedArtifacts == null ? getExpectedFileNames(archSuffix) : checkOptions.expectedArtifacts.slice()).sort()) + assertThat(getFileNames(artifacts)).isEqualTo((checkOptions == null || checkOptions.expectedArtifacts == null ? getExpectedFileNames(archSuffix) : checkOptions.expectedArtifacts.slice()).sort()) if (checkOptions != null && checkOptions.expectedArtifacts != null) { return } - assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestApp-Setup-1.1.0${archSuffix}.exe`]) + assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).isEqualTo([`TestApp-Setup-1.1.0${archSuffix}.exe`]) const packageFile = path.join(path.dirname(artifacts[0].file), `TestApp-1.1.0-full.nupkg`) const unZipper = new DecompressZip(packageFile) @@ -257,7 +258,7 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp // console.log(JSON.stringify(files, null, 2)) const expectedContents = checkOptions == null || checkOptions.expectedContents == null ? expectedWinContents : checkOptions.expectedContents - assertThat(files).deepEqual(expectedContents.map(it => { + assertThat(files).isEqualTo(expectedContents.map(it => { if (it === "lib/net45/TestApp.exe") { return `lib/net45/${encodeURI(productName)}.exe` } @@ -272,7 +273,7 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp }) const expectedSpec = (await readFile(path.join(path.dirname(packageFile), "TestApp.nuspec"), "utf8")).replace(/\r\n/g, "\n") // console.log(expectedSpec) - assertThat(expectedSpec).equal(` + assertThat(expectedSpec).isEqualTo(` TestApp diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts index b855a2d752e..7150931ebb1 100755 --- a/test/src/helpers/runTests.ts +++ b/test/src/helpers/runTests.ts @@ -17,7 +17,7 @@ const rootDir = path.join(__dirname, "..", "..", "..") const testPackageDir = path.join(require("os").tmpdir(), "electron_builder_published") const testNodeModules = path.join(testPackageDir, "node_modules") -const electronVersion = "0.37.8" +const electronVersion = "1.2.1" async function main() { await BluebirdPromise.all([