@penskemediacorp/backstopjs-config 1.24.1 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/backstopjs-config.test.js +33 -19
- package/__tests__/fixtures/larva.config.js +5 -10
- package/__tests__/lib/getScenarios.test.js +38 -32
- package/__tests__/lib/utils.test.js +27 -11
- package/index.js +69 -42
- package/lib/getConfig.js +11 -5
- package/lib/getScenarios.js +28 -21
- package/lib/utils.js +14 -17
- package/package.json +2 -2
|
@@ -11,55 +11,69 @@ const processMocker = {
|
|
|
11
11
|
'/usr/local/Cellar/node/10.11.0/bin/node',
|
|
12
12
|
'/Users/laraschenck/Sites/pmc-deadline-2019/assets/node_modules/.bin/backstop',
|
|
13
13
|
'--configPath=node_modules/pmc-build-utils/lib/backstop.js',
|
|
14
|
-
'test'
|
|
14
|
+
'test',
|
|
15
15
|
],
|
|
16
16
|
argvWithUrl: [
|
|
17
17
|
'/usr/local/Cellar/node/10.11.0/bin/node',
|
|
18
18
|
'/Users/laraschenck/Sites/pmc-deadline-2019/assets/node_modules/.bin/backstop',
|
|
19
19
|
'--configPath=node_modules/pmc-build-utils/lib/backstop.js',
|
|
20
20
|
'test',
|
|
21
|
-
'--url=https://notlaura.com'
|
|
22
|
-
]
|
|
21
|
+
'--url=https://notlaura.com',
|
|
22
|
+
],
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const expectations = {
|
|
26
|
-
url: 'https://notlaura.com'
|
|
26
|
+
url: 'https://notlaura.com',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// Basically what happens in index.js
|
|
30
30
|
|
|
31
|
-
describe( 'url handling for backstop command', function() {
|
|
32
|
-
|
|
31
|
+
describe( 'url handling for backstop command', function () {
|
|
33
32
|
it( 'overrides the configuration url with a CLI argument', () => {
|
|
34
|
-
assert.equal(
|
|
35
|
-
|
|
33
|
+
assert.equal(
|
|
34
|
+
backstopUtils.maybeUseCliUrl(
|
|
35
|
+
processMocker.argvWithUrl,
|
|
36
|
+
appConfiguration.testBaseUrl
|
|
37
|
+
),
|
|
38
|
+
expectations.url
|
|
39
|
+
);
|
|
40
|
+
} );
|
|
36
41
|
|
|
37
42
|
it( 'uses the configuration URL if no URL parameter is passed', () => {
|
|
38
|
-
assert.equal(
|
|
39
|
-
|
|
43
|
+
assert.equal(
|
|
44
|
+
backstopUtils.maybeUseCliUrl(
|
|
45
|
+
processMocker.argv,
|
|
46
|
+
appConfiguration.testBaseUrl
|
|
47
|
+
),
|
|
48
|
+
appConfiguration.testBaseUrl
|
|
49
|
+
);
|
|
50
|
+
} );
|
|
40
51
|
|
|
41
52
|
it( 'returns a testPaths url if there are no larva modules', () => {
|
|
42
53
|
const scenarios = getScenarios(
|
|
43
54
|
appConfiguration.testBaseUrl,
|
|
44
55
|
appConfiguration.testPaths,
|
|
45
56
|
backstopUtils.prepareTestSelectors( null ),
|
|
46
|
-
{}
|
|
57
|
+
{}
|
|
58
|
+
);
|
|
47
59
|
|
|
48
60
|
// Remove larvaModules to test plain URLs
|
|
49
61
|
delete appConfiguration.larvaModules;
|
|
50
62
|
|
|
51
|
-
assert.equal(
|
|
52
|
-
|
|
63
|
+
assert.equal(
|
|
64
|
+
appConfiguration.testBaseUrl + appConfiguration.testPaths[ 0 ],
|
|
65
|
+
scenarios[ 0 ].url
|
|
66
|
+
);
|
|
67
|
+
} );
|
|
53
68
|
|
|
54
69
|
it( 'second scenario has a selector', () => {
|
|
55
70
|
const scenarios = getScenarios(
|
|
56
71
|
appConfiguration.testBaseUrl,
|
|
57
72
|
appConfiguration.testPaths,
|
|
58
73
|
backstopUtils.prepareTestSelectors( null ),
|
|
59
|
-
{}
|
|
60
|
-
|
|
61
|
-
assert.equal( scenarios[1].selectors[0], 'document' );
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
});
|
|
74
|
+
{}
|
|
75
|
+
);
|
|
65
76
|
|
|
77
|
+
assert.equal( scenarios[ 1 ].selectors[ 0 ], 'document' );
|
|
78
|
+
} );
|
|
79
|
+
} );
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
const path = require( 'path' );
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
4
|
backstop: {
|
|
6
5
|
testBaseUrl: 'https://pmc:for-the-win@deadline-2019.pmcqa.com',
|
|
7
|
-
testPaths: [
|
|
8
|
-
'/',
|
|
9
|
-
'/blog/'
|
|
10
|
-
],
|
|
6
|
+
testPaths: [ '/', '/blog/' ],
|
|
11
7
|
testScenario: {
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
delay: 5000,
|
|
9
|
+
misMatchThreshold: 0.5,
|
|
14
10
|
},
|
|
15
|
-
larvaModules: [ 'footer', 'mega-menu-content', 'social-share' ]
|
|
11
|
+
larvaModules: [ 'footer', 'mega-menu-content', 'social-share' ],
|
|
16
12
|
},
|
|
17
|
-
|
|
18
|
-
};
|
|
13
|
+
};
|
|
@@ -1,70 +1,76 @@
|
|
|
1
|
-
const getScenarios = require('../../lib/getScenarios');
|
|
1
|
+
const getScenarios = require( '../../lib/getScenarios' );
|
|
2
2
|
const assert = require( 'assert' );
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
paths: ['/modules/footer', '/modules/header'],
|
|
4
|
+
const stub = {
|
|
5
|
+
paths: [ '/modules/footer', '/modules/header' ],
|
|
6
6
|
urlBase: 'http://localhost:3000',
|
|
7
7
|
selectors: [ '.footer', '.header' ],
|
|
8
|
-
scenarioOverride: {}
|
|
8
|
+
scenarioOverride: {},
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const expectation = [
|
|
11
|
+
const expectation = [
|
|
12
|
+
{
|
|
12
13
|
label: '/modules/footer',
|
|
13
14
|
url: 'http://localhost:3000/modules/footer',
|
|
14
15
|
hideSelectors: [],
|
|
15
16
|
removeSelectors: [],
|
|
16
|
-
selectors: ['.footer'],
|
|
17
|
+
selectors: [ '.footer' ],
|
|
17
18
|
delay: 500,
|
|
18
19
|
misMatchThreshold: 0.1,
|
|
19
20
|
onBeforeScript: 'puppet/onBefore.js',
|
|
20
|
-
onReadyScript: 'puppet/onReady.js'
|
|
21
|
+
onReadyScript: 'puppet/onReady.js',
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
label: '/modules/header',
|
|
24
25
|
url: 'http://localhost:3000/modules/header',
|
|
25
26
|
hideSelectors: [],
|
|
26
27
|
removeSelectors: [],
|
|
27
|
-
selectors: ['.header'],
|
|
28
|
+
selectors: [ '.header' ],
|
|
28
29
|
delay: 500,
|
|
29
30
|
misMatchThreshold: 0.1,
|
|
30
31
|
onBeforeScript: 'puppet/onBefore.js',
|
|
31
|
-
onReadyScript: 'puppet/onReady.js'
|
|
32
|
-
}
|
|
32
|
+
onReadyScript: 'puppet/onReady.js',
|
|
33
|
+
},
|
|
33
34
|
];
|
|
34
35
|
|
|
35
|
-
describe('getScenarios', () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
stub.
|
|
36
|
+
describe( 'getScenarios', () => {
|
|
37
|
+
it( 'outputs backstop scenario objects', () => {
|
|
38
|
+
const testScenarios = getScenarios(
|
|
39
|
+
stub.urlBase,
|
|
40
|
+
stub.paths,
|
|
41
|
+
stub.selectors,
|
|
42
|
+
stub.scenarioOverride
|
|
41
43
|
);
|
|
42
44
|
|
|
43
45
|
assert.deepEqual( testScenarios, expectation );
|
|
46
|
+
} );
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
it('supports document for selector', () => {
|
|
48
|
-
|
|
48
|
+
it( 'supports document for selector', () => {
|
|
49
49
|
stub.selectors = [ 'document' ];
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
stub.urlBase,
|
|
51
|
+
const testScenarios = getScenarios(
|
|
52
|
+
stub.urlBase,
|
|
53
|
+
stub.paths,
|
|
54
|
+
stub.selectors,
|
|
55
|
+
stub.scenarioOverride
|
|
53
56
|
);
|
|
54
57
|
|
|
55
|
-
assert.deepEqual( testScenarios[0].selectors, stub.selectors );
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
+
assert.deepEqual( testScenarios[ 0 ].selectors, stub.selectors );
|
|
59
|
+
} );
|
|
58
60
|
|
|
59
61
|
it( 'overrides scenario config', () => {
|
|
60
|
-
|
|
61
62
|
stub.scenarioOverride.delay = 1000;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
stub.urlBase,
|
|
64
|
+
const testScenario = getScenarios(
|
|
65
|
+
stub.urlBase,
|
|
66
|
+
stub.paths,
|
|
67
|
+
stub.selectors,
|
|
68
|
+
stub.scenarioOverride
|
|
65
69
|
);
|
|
66
70
|
|
|
67
|
-
assert.deepEqual(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
assert.deepEqual(
|
|
72
|
+
testScenario[ 0 ].delay,
|
|
73
|
+
stub.scenarioOverride.delay
|
|
74
|
+
);
|
|
75
|
+
} );
|
|
76
|
+
} );
|
|
@@ -6,24 +6,40 @@ const { prepareTestPaths, prepareTestSelectors } = require( '../../lib/utils' );
|
|
|
6
6
|
const getAppConfiguration = require( '../../lib/getConfig' );
|
|
7
7
|
const appConfiguration = getAppConfiguration( 'backstop' );
|
|
8
8
|
|
|
9
|
-
describe( 'backstop utils', function() {
|
|
10
|
-
|
|
9
|
+
describe( 'backstop utils', function () {
|
|
11
10
|
it( 'prepareTestPaths - returns paths for modules if present', () => {
|
|
12
11
|
assert.deepEqual(
|
|
13
|
-
prepareTestPaths(
|
|
14
|
-
|
|
12
|
+
prepareTestPaths(
|
|
13
|
+
appConfiguration.larvaModules,
|
|
14
|
+
appConfiguration.testPaths
|
|
15
|
+
),
|
|
16
|
+
[
|
|
17
|
+
'/modules/footer',
|
|
18
|
+
'/modules/mega-menu-content',
|
|
19
|
+
'/modules/social-share',
|
|
20
|
+
]
|
|
15
21
|
);
|
|
16
|
-
});
|
|
22
|
+
} );
|
|
17
23
|
|
|
18
24
|
it( 'prepareTestPaths - returns array of pmcPaths if no larva modules', () => {
|
|
19
|
-
assert.deepEqual(
|
|
20
|
-
|
|
25
|
+
assert.deepEqual(
|
|
26
|
+
prepareTestPaths( [], [ '/', '/blog/', '/about/' ] ),
|
|
27
|
+
[ '/', '/blog/', '/about/' ]
|
|
28
|
+
);
|
|
29
|
+
} );
|
|
21
30
|
|
|
22
31
|
it( 'prepareTestSelectors - adds a . in front of each module to make it a class', () => {
|
|
23
|
-
assert.deepEqual(
|
|
24
|
-
|
|
32
|
+
assert.deepEqual(
|
|
33
|
+
prepareTestSelectors( [
|
|
34
|
+
'footer',
|
|
35
|
+
'mega-menu-content',
|
|
36
|
+
'social-share',
|
|
37
|
+
] ),
|
|
38
|
+
[ '.footer', '.mega-menu-content', '.social-share' ]
|
|
39
|
+
);
|
|
40
|
+
} );
|
|
25
41
|
|
|
26
42
|
it( 'prepareTestSelectors - returns document if array of modules is null', () => {
|
|
27
43
|
assert.deepEqual( prepareTestSelectors( null ), [ 'document' ] );
|
|
28
|
-
});
|
|
29
|
-
});
|
|
44
|
+
} );
|
|
45
|
+
} );
|
package/index.js
CHANGED
|
@@ -14,64 +14,91 @@ const cliArgs = ( function getCliArgs() {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return process.argv;
|
|
17
|
-
}()
|
|
17
|
+
} )();
|
|
18
18
|
|
|
19
|
-
const urlBase = backstopUtils.maybeUseCliUrl(
|
|
20
|
-
|
|
19
|
+
const urlBase = backstopUtils.maybeUseCliUrl(
|
|
20
|
+
cliArgs,
|
|
21
|
+
appConfiguration.testBaseUrl
|
|
22
|
+
);
|
|
23
|
+
const selectors = backstopUtils.prepareTestSelectors(
|
|
24
|
+
appConfiguration.larvaModules || null
|
|
25
|
+
);
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
const paths = backstopUtils.prepareTestPaths(
|
|
28
|
+
appConfiguration.larvaModules,
|
|
29
|
+
appConfiguration.testPaths
|
|
30
|
+
);
|
|
23
31
|
|
|
24
32
|
// Exit if no paths in config.
|
|
25
33
|
if ( 0 === paths.length ) {
|
|
26
|
-
console.error(
|
|
34
|
+
console.error(
|
|
35
|
+
chalk.red.bold(
|
|
36
|
+
'\nPlease specify paths to test in larva.config.js in the structure `backstop.testPaths`, or add modules in `backstop.larvaModules`\n'
|
|
37
|
+
)
|
|
38
|
+
);
|
|
27
39
|
process.exit( 1 );
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
// Exit if no URL from config or CLI.
|
|
31
43
|
if ( undefined === appConfiguration.testBaseUrl && false === urlFromCli ) {
|
|
32
|
-
console.error(
|
|
44
|
+
console.error(
|
|
45
|
+
chalk.red.bold(
|
|
46
|
+
'\nPlease specify a QA URL in pmc.config.js in `backstop.testBaseUrl`, or pass in a full URL with the comman e.g. `npm run backstop -- test --url=https://example.com`\n'
|
|
47
|
+
)
|
|
48
|
+
);
|
|
33
49
|
process.exit( 1 );
|
|
34
50
|
}
|
|
35
51
|
|
|
36
|
-
const scenarios = getScenarios(
|
|
52
|
+
const scenarios = getScenarios(
|
|
53
|
+
urlBase,
|
|
54
|
+
paths,
|
|
55
|
+
selectors,
|
|
56
|
+
appConfiguration.testScenario
|
|
57
|
+
);
|
|
37
58
|
|
|
38
59
|
console.log( chalk.blue( 'Testing paths: \n' + paths ) );
|
|
39
60
|
|
|
40
|
-
module.exports = merge(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
module.exports = merge(
|
|
62
|
+
{
|
|
63
|
+
id: 'backstop_test',
|
|
64
|
+
viewports: [
|
|
65
|
+
{
|
|
66
|
+
name: 'small',
|
|
67
|
+
width: 400,
|
|
68
|
+
height: 620,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'desktop',
|
|
72
|
+
width: 1000,
|
|
73
|
+
height: 800,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'desktop-xl',
|
|
77
|
+
width: 1300,
|
|
78
|
+
height: 1000,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
scenarios,
|
|
82
|
+
paths: {
|
|
83
|
+
bitmaps_reference:
|
|
84
|
+
process.cwd() + '/backstop_data/bitmaps_reference',
|
|
85
|
+
bitmaps_test: process.cwd() + '/backstop_data/bitmaps_test',
|
|
86
|
+
engine_scripts: path.join(
|
|
87
|
+
__dirname,
|
|
88
|
+
'./backstop_data/engine_scripts'
|
|
89
|
+
),
|
|
90
|
+
html_report: process.cwd() + '/backstop_data/html_report',
|
|
91
|
+
ci_report: process.cwd() + '/backstop_data/ci_report',
|
|
47
92
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
93
|
+
report: [ 'browser' ],
|
|
94
|
+
engine: 'puppeteer',
|
|
95
|
+
engineOptions: {
|
|
96
|
+
waitTimeout: 120000,
|
|
52
97
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
'scenarios': scenarios,
|
|
60
|
-
'paths': {
|
|
61
|
-
'bitmaps_reference': process.cwd() + '/backstop_data/bitmaps_reference',
|
|
62
|
-
'bitmaps_test': process.cwd() + '/backstop_data/bitmaps_test',
|
|
63
|
-
'engine_scripts': path.join( __dirname, './backstop_data/engine_scripts' ),
|
|
64
|
-
'html_report': process.cwd() + '/backstop_data/html_report',
|
|
65
|
-
'ci_report': process.cwd() + '/backstop_data/ci_report'
|
|
98
|
+
asyncCaptureLimit: 5,
|
|
99
|
+
asyncCompareLimit: 50,
|
|
100
|
+
debug: false,
|
|
101
|
+
debugWindow: false,
|
|
66
102
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'engineOptions': {
|
|
70
|
-
'waitTimeout': 120000
|
|
71
|
-
},
|
|
72
|
-
'asyncCaptureLimit': 5,
|
|
73
|
-
'asyncCompareLimit': 50,
|
|
74
|
-
'debug': false,
|
|
75
|
-
'debugWindow': false
|
|
76
|
-
}, appConfiguration.backstopConfig );
|
|
77
|
-
|
|
103
|
+
appConfiguration.backstopConfig
|
|
104
|
+
);
|
package/lib/getConfig.js
CHANGED
|
@@ -20,7 +20,6 @@ const path = require( 'path' );
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
module.exports = function getAppConfiguration( key ) {
|
|
23
|
-
|
|
24
23
|
try {
|
|
25
24
|
let appRoot = process.cwd();
|
|
26
25
|
|
|
@@ -28,15 +27,22 @@ module.exports = function getAppConfiguration( key ) {
|
|
|
28
27
|
appRoot = path.join( __dirname, '../__tests__/fixtures' );
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const config = require( `${ appRoot }/larva.config.js` )[ key ];
|
|
32
31
|
|
|
33
32
|
if ( undefined === config ) {
|
|
34
|
-
throw new Error(
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Configuration for \`${ key }\` is required in larva.config.js. \nPlease refer to the Larva's docs for adding configuration: https://github.com/penske-media-corp/pmc-larva`
|
|
35
|
+
);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
return config;
|
|
38
|
-
|
|
39
39
|
} catch ( error ) {
|
|
40
|
-
console.error(
|
|
40
|
+
console.error(
|
|
41
|
+
chalk.red(
|
|
42
|
+
chalk.bold(
|
|
43
|
+
'There is no larva.config.js in this directory.\n'
|
|
44
|
+
) + error
|
|
45
|
+
)
|
|
46
|
+
);
|
|
41
47
|
}
|
|
42
48
|
};
|
package/lib/getScenarios.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
const { merge } = require( 'webpack-merge' );
|
|
2
2
|
|
|
3
|
-
module.exports = function getScenarios(
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
module.exports = function getScenarios(
|
|
4
|
+
urlBase,
|
|
5
|
+
paths,
|
|
6
|
+
selectorArr,
|
|
7
|
+
scenarioOverride
|
|
8
|
+
) {
|
|
9
|
+
const scenarios = [];
|
|
6
10
|
|
|
7
11
|
for ( let i = 0; i < paths.length; i++ ) {
|
|
12
|
+
const selectors =
|
|
13
|
+
1 === selectorArr.length ? selectorArr[ 0 ] : selectorArr[ i ];
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.log( urlBase + paths[i] );
|
|
15
|
+
console.log( urlBase + paths[ i ] );
|
|
12
16
|
|
|
13
|
-
scenarios.push(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
scenarios.push(
|
|
18
|
+
merge(
|
|
19
|
+
{
|
|
20
|
+
label: paths[ i ],
|
|
21
|
+
url: urlBase + paths[ i ],
|
|
22
|
+
hideSelectors: [],
|
|
23
|
+
removeSelectors: [],
|
|
24
|
+
selectors: [ selectors ],
|
|
25
|
+
delay: 500,
|
|
26
|
+
misMatchThreshold: 0.1,
|
|
27
|
+
onBeforeScript: 'puppet/onBefore.js',
|
|
28
|
+
onReadyScript: 'puppet/onReady.js',
|
|
29
|
+
},
|
|
30
|
+
scenarioOverride
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
27
34
|
|
|
28
35
|
return scenarios;
|
|
29
|
-
}
|
|
36
|
+
};
|
package/lib/utils.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
maybeUseCliUrl: ( argv, configUrl ) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return argv[4].replace( '--url=', '' );
|
|
3
|
+
if ( argv[ 4 ] && argv[ 4 ].includes( '--url=' ) ) {
|
|
4
|
+
return argv[ 4 ].replace( '--url=', '' );
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
return configUrl;
|
|
9
|
-
|
|
10
8
|
},
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Prepare Test Paths
|
|
14
|
-
*
|
|
12
|
+
*
|
|
15
13
|
* @param modules array of module names e.g. [ 'footer', 'header', 'author' ]
|
|
16
14
|
* @param pmcPaths array of test paths e.g. [ '/', '/blog ]
|
|
17
15
|
*/
|
|
18
16
|
prepareTestPaths: ( modules, pmcPaths ) => {
|
|
19
|
-
|
|
20
17
|
if ( modules && modules.length > 0 ) {
|
|
21
|
-
return modules.map( a => '/modules/' + a );
|
|
22
|
-
} else {
|
|
23
|
-
|
|
18
|
+
return modules.map( ( a ) => '/modules/' + a );
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
if ( pmcPaths && pmcPaths.length > 0 ) {
|
|
@@ -29,24 +24,26 @@ module.exports = {
|
|
|
29
24
|
|
|
30
25
|
// We are not testing patterns. Return array of paths from config.
|
|
31
26
|
|
|
32
|
-
throw new Error(
|
|
27
|
+
throw new Error(
|
|
28
|
+
chalk.red.bold(
|
|
29
|
+
"Couldn't find configuration for larvaModukes or testPaths. Make sure those entries exist in the `backstop` object in larva.config.js"
|
|
30
|
+
)
|
|
31
|
+
);
|
|
33
32
|
},
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
/**
|
|
36
35
|
* Prepare Module Selectors
|
|
37
|
-
*
|
|
36
|
+
*
|
|
38
37
|
* Make a class selector out of each module from CLI, or return document.
|
|
39
|
-
*
|
|
38
|
+
*
|
|
40
39
|
* @param array of modules
|
|
41
40
|
*/
|
|
42
41
|
prepareTestSelectors: ( array ) => {
|
|
43
|
-
|
|
44
42
|
// Test the whole document if there are no modules in the CLI
|
|
45
43
|
if ( null === array ) {
|
|
46
44
|
return [ 'document' ];
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
return array.map( a => '.' + a );
|
|
50
|
-
}
|
|
51
|
-
|
|
47
|
+
return array.map( ( a ) => '.' + a );
|
|
48
|
+
},
|
|
52
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penskemediacorp/backstopjs-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Visual regression testing with Backstop JS.",
|
|
5
5
|
"author": "laras126 <laras126@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/penske-media-corp/pmc-larva#readme",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"chalk": "^4.1.0",
|
|
28
28
|
"webpack-merge": "^5.0.9"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "b9202e08f96e47041512b3b1a743c58f89b39152"
|
|
31
31
|
}
|