@@ -15,6 +15,8 @@ const getTestRoot = (testConfig, globalConfig) => {
1515 return testRoot ;
1616} ;
1717
18+ const getSanitizedName = name => name . replace ( / \/ / g, '-' ) ;
19+
1820export const getSnapshotsDir = ( testConfig , globalConfig ) => path . join (
1921 getTestRoot ( testConfig , globalConfig ) ,
2022 '__image_snapshots__' ,
@@ -26,14 +28,16 @@ export const getSnapshotPath = (snapshotsDir, testConfig) => {
2628 if ( ! snapshotsDir || ! testConfig ) {
2729 throw new Error ( 'Incorrect arguments passed to getSnapshotPath' ) ;
2830 }
29- return path . join ( snapshotsDir , `${ testConfig . testName } .snap.${ testConfig . imageType || 'png' } ` ) ;
31+ const testName = getSanitizedName ( testConfig . testName ) ;
32+ return path . join ( snapshotsDir , `${ testName } .snap.${ testConfig . imageType || 'png' } ` ) ;
3033} ;
3134
3235export const getDiffPath = ( diffDir , testConfig ) => {
3336 if ( ! diffDir || ! testConfig ) {
3437 throw new Error ( 'Incorrect arguments passed to getDiffPath' ) ;
3538 }
36- return path . join ( diffDir , `${ testConfig . testName } .differencified.${ testConfig . imageType || 'png' } ` ) ;
39+ const testName = getSanitizedName ( testConfig . testName ) ;
40+ return path . join ( diffDir , `${ testName } .differencified.${ testConfig . imageType || 'png' } ` ) ;
3741} ;
3842
3943export const getCurrentImageDir = snapshotsDir => path . join ( snapshotsDir , '__current_output__' ) ;
@@ -42,5 +46,6 @@ export const getCurrentImagePath = (currentImageDir, testConfig) => {
4246 if ( ! currentImageDir || ! testConfig ) {
4347 throw new Error ( 'Incorrect arguments passed to getDiffPath' ) ;
4448 }
45- return path . join ( currentImageDir , `${ testConfig . testName } .current.${ testConfig . imageType || 'png' } ` ) ;
49+ const testName = getSanitizedName ( testConfig . testName ) ;
50+ return path . join ( currentImageDir , `${ testName } .current.${ testConfig . imageType || 'png' } ` ) ;
4651} ;
0 commit comments