Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta committed Mar 25, 2024
1 parent 336d321 commit 33f234f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/electron-builder/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function publish(args: { files: string[] }) {
arch: null,
}
})
await publishArtifactsWithOptions(uploadTasks)
return publishArtifactsWithOptions(uploadTasks)
}

export async function publishArtifactsWithOptions(uploadOptions: { file: string; arch: string | null }[], publishConfiguration?: PublishConfiguration[]) {
Expand Down Expand Up @@ -97,8 +97,10 @@ async function publishPackageWithTasks(
promise = publishManager.awaitTasks()
}

return promise.then(() => process.removeListener("SIGINT", sigIntHandler))
})
return promise.then(() => {
process.removeListener("SIGINT", sigIntHandler)
})
}).then(() => uploadTasks)
}

function main() {
Expand Down
11 changes: 9 additions & 2 deletions test/src/ArtifactPublisherTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { KeygenPublisher } from "app-builder-lib/out/publish/KeygenPublisher"
import { Platform } from "app-builder-lib"
import { createPublisher } from "app-builder-lib/out/publish/PublishManager"
import { BitbucketPublisher } from "app-builder-lib/out/publish/BitbucketPublisher"
import { publishArtifactsWithOptions } from "electron-builder"

if (isCi && process.platform === "win32") {
fit("Skip ArtifactPublisherTest suite on Windows CI", () => {
Expand Down Expand Up @@ -150,14 +151,20 @@ test.ifEnv(process.env.KEYGEN_TOKEN)("Keygen upload", async () => {

test.ifEnv(process.env.BITBUCKET_TOKEN)("Bitbucket upload", async () => {
const timeout = 0
const publisher = new BitbucketPublisher(publishContext, {
const config: BitbucketOptions = {
provider: "bitbucket",
owner: "mike-m",
slug: "electron-builder-test",
timeout,
} as BitbucketOptions)
}
const publisher = new BitbucketPublisher(publishContext, config)
const filename = await publisher.upload({ file: iconPath, arch: Arch.x64, timeout })
await publisher.deleteRelease(filename)

const uploadTasks = await publishArtifactsWithOptions([{ file: icoPath, arch: null }], [config])
for (const task of uploadTasks) {
await publisher.deleteRelease(task.file)
}
})

test.ifEnv(process.env.BITBUCKET_TOKEN)("Bitbucket upload", async () => {
Expand Down

0 comments on commit 33f234f

Please sign in to comment.