Skip to content

Commit

Permalink
fix(tests): fix config acceptance tests & config command
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed Jul 4, 2017
1 parent 0a75eb7 commit 1958d63
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/commands/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class ConfigCommand extends Command {
// Because the 'port' option can end up being different than the one supplied
// in the URL itself, we want to make sure the port in the URL
// (if one was there to begin with) is correct.
let parsedUrl = url.parse(this.config.get('url'));
if (parsedUrl.port && parsedUrl.port !== this.config.get('server.port')) {
parsedUrl.port = this.config.get('server.port');
let parsedUrl = url.parse(this.instance.config.get('url'));
if (parsedUrl.port && parsedUrl.port !== this.instance.config.get('server.port')) {
parsedUrl.port = this.instance.config.get('server.port');
// url.format won't take the new port unless 'parsedUrl.host' is undefined
delete parsedUrl.host;

Expand Down
1 change: 1 addition & 0 deletions test/acceptance/config-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe('Acceptance: Config', function () {
test.setup('full');

return test.spawn({
environment: 'production',
failOnStdErr: true,
checkOutput: () => false,
stdin: [
Expand Down
4 changes: 1 addition & 3 deletions test/utils/acceptance-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
const fs = require('fs-extra');
const cp = require('child_process');
const tmp = require('tmp');
const find = require('lodash/find');
const each = require('lodash/each');
const path = require('path');
const env = require('./env');

Expand Down Expand Up @@ -104,7 +102,7 @@ module.exports = class AcceptanceTest {
return new Promise((resolve, reject) => {
this.spawnedCommand = cp.spawn(this.cliPath, this.command.split(' '), {
env: Object.assign({}, process.env, {
NODE_ENV: this.environment
NODE_ENV: options.environment || 'production'
}, options.env || {}),
cwd: this.dir,
stdio: 'pipe'
Expand Down
2 changes: 1 addition & 1 deletion test/utils/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const isObject = require('lodash/isObject');

const builtin = {
full: {
dirs: ['versions/1.0.0', 'config', 'content'],
dirs: ['versions/1.0.0', 'content'],
links: [
['versions/1.0.0', 'current'],
['content', 'current/content']
Expand Down

0 comments on commit 1958d63

Please sign in to comment.