Add index suffix before extension
This commit is contained in:
parent
6abb978eae
commit
56afacb1e2
|
|
@ -140,7 +140,7 @@ class SnapshotHelper {
|
||||||
snapshotNames.namedSnapshotIndex[joinedName] = (snapshotNames.namedSnapshotIndex[joinedName] || 0) + 1;
|
snapshotNames.namedSnapshotIndex[joinedName] = (snapshotNames.namedSnapshotIndex[joinedName] || 0) + 1;
|
||||||
const index = snapshotNames.namedSnapshotIndex[joinedName];
|
const index = snapshotNames.namedSnapshotIndex[joinedName];
|
||||||
if (index > 1)
|
if (index > 1)
|
||||||
this.snapshotName = `${joinedName}-${index - 1}`;
|
this.snapshotName = addSuffixToFilePath(joinedName, `-${index - 1}`);
|
||||||
else
|
else
|
||||||
this.snapshotName = joinedName;
|
this.snapshotName = joinedName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,14 +128,14 @@ test('should generate separate actual results for repeating names', async ({ run
|
||||||
'path': 'a-is-a-test/foo-actual.txt'
|
'path': 'a-is-a-test/foo-actual.txt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'foo-expected.txt-1',
|
'name': 'foo-1-expected.txt',
|
||||||
'contentType': 'text/plain',
|
'contentType': 'text/plain',
|
||||||
'path': 'golden-should-generate-separate-actual-results-for-repeating-names-playwright-test/a.spec.js-snapshots/foo.txt'
|
'path': 'golden-should-generate-separate-actual-results-for-repeating-names-playwright-test/a.spec.js-snapshots/foo.txt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'foo-actual.txt-1',
|
'name': 'foo-1-actual.txt',
|
||||||
'contentType': 'text/plain',
|
'contentType': 'text/plain',
|
||||||
'path': 'a-is-a-test/foo-actual.txt-1'
|
'path': 'a-is-a-test/foo-1-actual.txt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'bar/baz-expected.txt',
|
'name': 'bar/baz-expected.txt',
|
||||||
|
|
@ -148,14 +148,14 @@ test('should generate separate actual results for repeating names', async ({ run
|
||||||
'path': 'a-is-a-test/bar-baz-actual.txt'
|
'path': 'a-is-a-test/bar-baz-actual.txt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'bar/baz-expected.txt-1',
|
'name': 'bar/baz-1-expected.txt',
|
||||||
'contentType': 'text/plain',
|
'contentType': 'text/plain',
|
||||||
'path': 'golden-should-generate-separate-actual-results-for-repeating-names-playwright-test/a.spec.js-snapshots/bar/baz.txt'
|
'path': 'golden-should-generate-separate-actual-results-for-repeating-names-playwright-test/a.spec.js-snapshots/bar/baz.txt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'bar/baz-actual.txt-1',
|
'name': 'bar/baz-1-actual.txt',
|
||||||
'contentType': 'text/plain',
|
'contentType': 'text/plain',
|
||||||
'path': 'a-is-a-test/bar-baz-actual.txt-1'
|
'path': 'a-is-a-test/bar-baz-1-actual.txt'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue