Skip to content

Commit 8f077f9

Browse files
committed
Organization/cleanup
1 parent 8c64a86 commit 8f077f9

13 files changed

+70
-58
lines changed

dist/backstopConfig.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
55
});
66
exports.default = backstopConfig;
77

8-
function untrailingSlashIt(string) {
9-
return string.replace(/\/$/, "");
10-
}
8+
var _utils = require("./utils");
119

1210
function backstopConfig(nonProductionBaseUrl, productionBaseUrl, pathsToTest, siteName) {
1311
const backstopDataDir = `backstop_data/${siteName}`;
@@ -27,8 +25,8 @@ function backstopConfig(nonProductionBaseUrl, productionBaseUrl, pathsToTest, si
2725
}],
2826
'scenarios': [{
2927
'label': 'Homepage',
30-
'url': nonProductionBaseUrl,
31-
'referenceUrl': productionBaseUrl,
28+
'url': (0, _utils.trailingSlashIt)(nonProductionBaseUrl),
29+
'referenceUrl': (0, _utils.trailingSlashIt)(productionBaseUrl),
3230
'hideSelectors': [],
3331
'selectors': ['document'],
3432
'readyEvent': null,
@@ -54,8 +52,8 @@ function backstopConfig(nonProductionBaseUrl, productionBaseUrl, pathsToTest, si
5452
const scenarios = pathsToTest.map(function (path) {
5553
return {
5654
'label': path,
57-
'url': untrailingSlashIt(nonProductionBaseUrl) + path,
58-
'referenceUrl': untrailingSlashIt(productionBaseUrl) + path,
55+
'url': (0, _utils.trailingSlashIt)(nonProductionBaseUrl) + (0, _utils.untrailingSlashIt)(path),
56+
'referenceUrl': (0, _utils.trailingSlashIt)(productionBaseUrl) + (0, _utils.untrailingSlashIt)(path),
5957
'hideSelectors': [],
6058
'selectors': ['document'],
6159
'readyEvent': null,

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var _visualRegressionTestSite = _interopRequireDefault(require("./visualRegressi
1212

1313
var _sitesToTest = _interopRequireDefault(require("./sitesToTest"));
1414

15-
var _throwError = _interopRequireDefault(require("./throwError"));
15+
var _utils = require("./utils");
1616

1717
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1818

@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
2121
const siteNames = Object.keys(_sitesToTest.default); // Throw an error if there are not sites defined
2222

2323
if (siteNames.length === 0) {
24-
(0, _throwError.default)(_ansiColors.default.red(`There are no sites defined in the ${_ansiColors.default.grey('sitesToTest.js')} config file`));
24+
(0, _utils.throwError)(_ansiColors.default.red(`There are no sites defined in the ${_ansiColors.default.grey('sitesToTest.js')} config file`));
2525
} // Start a new program
2626

2727

dist/sitesToTest.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
55
});
66
exports.default = void 0;
77
const sitesToTest = {
8-
'return-to-pantheon-test': {
9-
label: 'Return to Pantheon Test',
10-
productionBaseUrl: 'https://live-return-to-pantheon-test.pantheonsite.io/',
11-
nonProductionBaseUrl: 'https://dev-return-to-pantheon-test.pantheonsite.io/',
8+
"return-to-pantheon-test": {
9+
label: "Return to Pantheon Test",
10+
productionBaseUrl: "https://live-return-to-pantheon-test.pantheonsite.io/",
11+
nonProductionBaseUrl: "https://dev-return-to-pantheon-test.pantheonsite.io/",
1212
pathsToTest: ["/2018/04/", "/2018/04/04/hello-world/"]
1313
},
14-
'wordpress-at-scale': {
15-
label: 'WordPress at Scale',
16-
productionBaseUrl: 'https://scalewp.io/',
17-
nonProductionBaseUrl: 'https://dev-wp-microsite.pantheonsite.io/',
14+
"wordpress-at-scale": {
15+
label: "WordPress at Scale",
16+
productionBaseUrl: "https://scalewp.io/",
17+
nonProductionBaseUrl: "https://dev-wp-microsite.pantheonsite.io/",
1818
pathsToTest: ["/resources", "/elastic-architecture", "/page-caching", "/object-caching", "/query-performance", "/searching-for-scale", "/a-real-world-scalable-architecture", "/development-and-workflow"]
1919
}
2020
};

dist/throwError.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

dist/utils.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.throwError = throwError;
7+
exports.untrailingSlashIt = untrailingSlashIt;
8+
exports.trailingSlashIt = trailingSlashIt;
9+
10+
function throwError(message) {
11+
console.error(message);
12+
process.exit(0);
13+
}
14+
15+
function untrailingSlashIt(str) {
16+
return str.replace(/\/$/, '');
17+
}
18+
19+
function trailingSlashIt(str) {
20+
return str.replace(/\/$/, '') + '/';
21+
}

dist/visualRegressionTestSite.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var _fancyLog = _interopRequireDefault(require("fancy-log"));
1111

1212
var _ansiColors = _interopRequireDefault(require("ansi-colors"));
1313

14-
var _throwError = _interopRequireDefault(require("./throwError"));
14+
var _utils = require("./utils");
1515

1616
var _backstopConfig = _interopRequireDefault(require("./backstopConfig"));
1717

@@ -26,9 +26,8 @@ function _default(siteToTest) {
2626
const siteExists = Object.prototype.hasOwnProperty.call(_sitesToTest.default, siteToTest); // Throw an error if it doesn't
2727

2828
if (!siteExists) {
29-
(0, _throwError.default)(_ansiColors.default.red(`${_ansiColors.default.bold(siteToTest)} is not a valid site. Check the name you entered against the ${_ansiColors.default.grey('sitesToTest.js')} config file`));
30-
} // Stash the current site
31-
29+
(0, _utils.throwError)(_ansiColors.default.red(`${_ansiColors.default.bold(siteToTest)} is not a valid site. Check the name you entered against the ${_ansiColors.default.grey('sitesToTest.js')} config file`));
30+
}
3231

3332
const site = _sitesToTest.default[siteToTest]; // Stash the site label
3433

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/backstopConfig.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
function untrailingSlashIt(string) {
2-
return string.replace(/\/$/, "");
3-
}
1+
import {untrailingSlashIt, trailingSlashIt} from './utils';
42

53
export default function backstopConfig(nonProductionBaseUrl, productionBaseUrl, pathsToTest, siteName) {
64

@@ -24,8 +22,8 @@ export default function backstopConfig(nonProductionBaseUrl, productionBaseUrl,
2422
],
2523
'scenarios': [{
2624
'label': 'Homepage',
27-
'url': nonProductionBaseUrl,
28-
'referenceUrl': productionBaseUrl,
25+
'url': trailingSlashIt(nonProductionBaseUrl),
26+
'referenceUrl': trailingSlashIt(productionBaseUrl),
2927
'hideSelectors': [],
3028
'selectors': ['document'],
3129
'readyEvent': null,
@@ -54,8 +52,8 @@ export default function backstopConfig(nonProductionBaseUrl, productionBaseUrl,
5452

5553
return {
5654
'label': path,
57-
'url': untrailingSlashIt(nonProductionBaseUrl) + path,
58-
'referenceUrl': untrailingSlashIt(productionBaseUrl) + path,
55+
'url': trailingSlashIt(nonProductionBaseUrl) + untrailingSlashIt(path),
56+
'referenceUrl': trailingSlashIt(productionBaseUrl) + untrailingSlashIt(path),
5957
'hideSelectors': [],
6058
'selectors': ['document'],
6159
'readyEvent': null,

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import colors from 'ansi-colors';
88
// Local dependencies
99
import visualRegressionTestSite from './visualRegressionTestSite';
1010
import sitesToTest from './sitesToTest';
11-
import throwError from './throwError';
11+
import {throwError} from './utils';
1212

1313
// Get the site names
1414
const siteNames = Object.keys(sitesToTest);

src/sitesToTest.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
const sitesToTest = {
2-
'return-to-pantheon-test': {
3-
label: 'Return to Pantheon Test',
4-
productionBaseUrl: 'https://live-return-to-pantheon-test.pantheonsite.io/',
5-
nonProductionBaseUrl: 'https://dev-return-to-pantheon-test.pantheonsite.io/',
2+
"return-to-pantheon-test": {
3+
label: "Return to Pantheon Test",
4+
productionBaseUrl: "https://live-return-to-pantheon-test.pantheonsite.io/",
5+
nonProductionBaseUrl: "https://dev-return-to-pantheon-test.pantheonsite.io/",
66
pathsToTest: [
77
"/2018/04/",
88
"/2018/04/04/hello-world/",
99
]
1010
},
11-
'wordpress-at-scale': {
12-
label: 'WordPress at Scale',
13-
productionBaseUrl: 'https://scalewp.io/',
14-
nonProductionBaseUrl: 'https://dev-wp-microsite.pantheonsite.io/',
11+
"wordpress-at-scale": {
12+
label: "WordPress at Scale",
13+
productionBaseUrl: "https://scalewp.io/",
14+
nonProductionBaseUrl: "https://dev-wp-microsite.pantheonsite.io/",
1515
pathsToTest: [
1616
"/resources",
1717
"/elastic-architecture",
@@ -25,4 +25,4 @@ const sitesToTest = {
2525
}
2626
};
2727

28-
export default sitesToTest;
28+
export default sitesToTest;

0 commit comments

Comments
 (0)