Skip to content

Commit 36582ca

Browse files
committed
backstop remote command takes --config arg
Modified /command/remote to pass config.backstopConfigFileName to "remote" child process. Modified Remote script to set PROJECT_PATH and PATH_TO_CONFIG on passed values only.
1 parent 276674b commit 36582ca

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

core/command/remote.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ const ssws = resolver.sync('super-simple-web-server', { basedir: __dirname });
66

77
module.exports = {
88
execute: function (config) {
9-
logger.log('Starting remote.');
10-
119
const MIDDLEWARE_PATH = path.resolve(config.backstop, 'remote');
1210
const projectPath = path.resolve(config.projectPath);
1311

1412
return new Promise(function (resolve, reject) {
15-
logger.log(`Starting remote with: node ${ssws} ${projectPath} ${MIDDLEWARE_PATH}`);
13+
logger.log(`Starting remote with: node ${ssws} ${projectPath} ${MIDDLEWARE_PATH} --config=${config.backstopConfigFileName}`);
1614

17-
const child = exec(`node ${ssws} ${projectPath} ${MIDDLEWARE_PATH}`);
15+
const child = exec(`node ${ssws} ${projectPath} ${MIDDLEWARE_PATH} --config=${config.backstopConfigFileName}`);
1816

1917
child.stdout.on('data', (data) => {
2018
logger.log(data);

remote/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
/* eslint no-console: off */
22
'use strict';
33

4+
var parseArgs = require('minimist');
5+
var argsOptions = parseArgs(process.argv.slice(2), {
6+
string: ['config']
7+
});
8+
var PROJECT_PATH = argsOptions._[0];
9+
var PATH_TO_CONFIG = argsOptions.config;
10+
var _config = require(argsOptions.config);
11+
412
var path = require('path');
513
var express = require('express');
614
var backstop = require('../core/runner');
7-
var PROJECT_PATH = process.cwd();
8-
var PATH_TO_CONFIG = path.resolve(PROJECT_PATH, 'backstop');
9-
var _config = require(PATH_TO_CONFIG);
1015
var { modifyJsonpReport } = require('../core/util/remote');
1116

1217
module.exports = function (app) {

0 commit comments

Comments
 (0)