Skip to content

Commit

Permalink
backstop remote command takes --config arg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
garris committed Jul 24, 2020
1 parent 276674b commit 36582ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 2 additions & 4 deletions core/command/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ const ssws = resolver.sync('super-simple-web-server', { basedir: __dirname });

module.exports = {
execute: function (config) {
logger.log('Starting remote.');

const MIDDLEWARE_PATH = path.resolve(config.backstop, 'remote');
const projectPath = path.resolve(config.projectPath);

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

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

child.stdout.on('data', (data) => {
logger.log(data);
Expand Down
11 changes: 8 additions & 3 deletions remote/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* eslint no-console: off */
'use strict';

var parseArgs = require('minimist');
var argsOptions = parseArgs(process.argv.slice(2), {
string: ['config']
});
var PROJECT_PATH = argsOptions._[0];
var PATH_TO_CONFIG = argsOptions.config;
var _config = require(argsOptions.config);

var path = require('path');
var express = require('express');
var backstop = require('../core/runner');
var PROJECT_PATH = process.cwd();
var PATH_TO_CONFIG = path.resolve(PROJECT_PATH, 'backstop');
var _config = require(PATH_TO_CONFIG);
var { modifyJsonpReport } = require('../core/util/remote');

module.exports = function (app) {
Expand Down

0 comments on commit 36582ca

Please sign in to comment.