From f38603de805f287378712a508a249d05d6f35c11 Mon Sep 17 00:00:00 2001 From: Felipe Castillo Date: Thu, 30 May 2019 22:26:16 -0700 Subject: [PATCH] Make code more readable --- src/installer.js | 5 ++++- test/helpers/describe_cli.js | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/installer.js b/src/installer.js index c2e3508..6eb2da4 100644 --- a/src/installer.js +++ b/src/installer.js @@ -102,7 +102,10 @@ class SquirrelInstaller extends common.ElectronInstaller { const packagePattern = path.join(this.stagingDir, 'nuget', '*.nupkg') this.options.logger(`Finding package with pattern ${packagePattern}`) - return common.wrapError('finding package with pattern', async () => (await glob(packagePattern))[0]) + return common.wrapError('finding package with pattern', async () => { + const files = await glob(packagePattern) + return files[0] + }) } /** diff --git a/test/helpers/describe_cli.js b/test/helpers/describe_cli.js index 528ce98..81e4bfe 100644 --- a/test/helpers/describe_cli.js +++ b/test/helpers/describe_cli.js @@ -4,7 +4,7 @@ const chai = require('chai') const fs = require('fs-extra') const { spawn } = require('electron-installer-common') const tmp = require('tmp-promise') -const { access, testAccess, accessAll } = require('./access_helper') +const { access, accessAll } = require('./access_helper') function printLogs (logs) { if (process.env.DEBUG === 'electron-installer-windows') { @@ -49,12 +49,7 @@ module.exports = function (desc, asar, options) { if (options.remoteReleases && asar) { it('does not generate a delta `.nupkg` package', async () => { - try { - await testAccess(`${options.dest}/${appName}-0.0.1-delta.nupkg'`) - throw new Error('delta `.nupkg` was created') - } catch (error) { - chai.expect(error.message).to.have.string('no such file or directory') - } + return chai.expect(await fs.pathExists(`${options.dest}/${appName}-0.0.1-delta.nupkg'`)).to.be.false }) }