From e5cd43938308e90ed6446a632c3ac6c64c2e16bd Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sun, 3 Sep 2017 16:51:37 +0200 Subject: [PATCH] Fixed tests for packed binary --- test/pack-now.js | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/test/pack-now.js b/test/pack-now.js index 853b79f..efcc34e 100755 --- a/test/pack-now.js +++ b/test/pack-now.js @@ -5,6 +5,9 @@ const path = require('path') const crossSpawn = require('cross-spawn') const test = require('ava') +// Utilities +const logo = require('../src/util/output/logo') + test.serial('make binary', async t => { if (!process.env.CI) { t.true(true) @@ -22,7 +25,7 @@ const binary = { }[process.platform] const binaryPath = path.resolve(__dirname, '../packed/' + binary) -const deployHelpMessage = `To deploy, run in any directory of your choosing` +const deployHelpMessage = `${logo} now [options] ` test.serial('packed "now help" prints deploy help message', async t => { if (!process.env.CI) { @@ -37,24 +40,22 @@ test.serial('packed "now help" prints deploy help message', async t => { t.true(stdout.includes(deployHelpMessage)) }) -function spawn(command, args) { - return new Promise((resolve, reject) => { - const child = crossSpawn.spawn(command, args) +const spawn = (command, args) => new Promise((resolve, reject) => { + const child = crossSpawn.spawn(command, args) - let stdout = '' - child.stdout.on('data', data => { - stdout += data - }) + let stdout = '' + child.stdout.on('data', data => { + stdout += data + }) - child.on('error', err => { - reject(err) - }) + child.on('error', err => { + reject(err) + }) - child.on('close', code => { - resolve({ - code, - stdout - }) + child.on('close', code => { + resolve({ + code, + stdout }) }) -} +})