From 25d5134953661d5148175491e2094e0da9edb0c7 Mon Sep 17 00:00:00 2001 From: Bartosz Wojtkowiak Date: Thu, 27 Sep 2018 13:33:30 +0200 Subject: [PATCH] Try to test `build-installer` --- lib/index.js | 5 ++++- tests/integration/integration.test.js | 30 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 07f7b8cf..5bffd5a5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -97,13 +97,16 @@ class MeteorDesktop { this.meteorApp.updateGitIgnore(); } - async buildInstaller() { + async buildInstaller(throwError = false) { this.env.options.installerBuild = true; await this.electronApp.build(); try { await this.electronBuilder.build(); } catch (e) { this.log.error('error occurred while building installer', e); + if (throwError) { + throw new Error(e); + } } } diff --git a/tests/integration/integration.test.js b/tests/integration/integration.test.js index 679b4dba..e4fe0546 100644 --- a/tests/integration/integration.test.js +++ b/tests/integration/integration.test.js @@ -223,6 +223,36 @@ describe('desktop', () => { expect(result.value).to.equal(1); }).timeout(10 * 60000); + it('should build installer', async () => { + MeteorDesktop = meteorDesktop( + appDir, + appDir, + { + ddpUrl: 'http://127.0.0.1:3080', + build: true, + output: appDir, + scaffold: true, + skipMobileBuild: true, + forceCordovaBuild: true, + skipRemoveMobilePlatform: true + } + ); + + if (fs.existsSync(path.join(appDir, MeteorDesktop.env.paths.installerDir))) { + shell.rm('-rf', MeteorDesktop.env.paths.installerDir); + } + + // Build the installer. + try { + await MeteorDesktop.buildInstaller(true); + } catch (e) { + throw new Error(e); + } + // For now we are just making an assumption that it went ok if it did not throw an error. + + expect(fs.existsSync(path.join(appDir, MeteorDesktop.env.paths.installerDir))).to.be.true(); + }).timeout(10 * 60000); + if (process.env.TRAVIS || process.env.APPVEYOR) { it('should build with -b', async () => { MeteorDesktop = meteorDesktop(