@chromatic-com/playwright 0.14.8 → 0.14.9

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/dist/index.js CHANGED
@@ -3919,9 +3919,13 @@ var STORIES_FILE_EXT = "stories.json";
3919
3919
  var uniqueId = {
3920
3920
  value: 1
3921
3921
  };
3922
- function storiesFileName(testTitle) {
3922
+ function storiesFileName(testTitle, overwriteDuplicateNames = true) {
3923
+ let title = sanitize(testTitle);
3924
+ if (!overwriteDuplicateNames) {
3925
+ title += "-" + uniqueId.value++;
3926
+ }
3923
3927
  const fileName = [
3924
- sanitize(testTitle) + "-" + uniqueId.value++,
3928
+ title,
3925
3929
  STORIES_FILE_EXT
3926
3930
  ].join(".");
3927
3931
  const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
@@ -4022,7 +4026,7 @@ function findDefaultViewport(viewports) {
4022
4026
  __name(findDefaultViewport, "findDefaultViewport");
4023
4027
 
4024
4028
  // ../shared/src/write-archive/index.ts
4025
- async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
4029
+ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
4026
4030
  const { titlePath, outputDir, pageUrl } = e2eTestInfo;
4027
4031
  const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
4028
4032
  // make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
@@ -4057,7 +4061,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
4057
4061
  const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
4058
4062
  await outputFile(path2.join(archiveDir, snapshotFile), mappedSnapshot);
4059
4063
  }));
4060
- const storiesFile = storiesFileName(title);
4064
+ const storiesFile = storiesFileName(title, testRunner !== "vitest");
4061
4065
  const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
4062
4066
  await outputJSONFile(path2.join(finalOutputDir, storiesFile), storiesJson);
4063
4067
  const errors = Object.entries(archive).filter(([, r]) => "error" in r);
@@ -4256,7 +4260,7 @@ var performChromaticSnapshot = /* @__PURE__ */ __name(async ({ page, delay, diff
4256
4260
  prefersReducedMotion,
4257
4261
  cropToViewport,
4258
4262
  ignoreSelectors
4259
- });
4263
+ }, "playwright");
4260
4264
  trackComplete();
4261
4265
  } finally {
4262
4266
  chromaticSnapshots.delete(testId);
package/dist/index.mjs CHANGED
@@ -3913,9 +3913,13 @@ var STORIES_FILE_EXT = "stories.json";
3913
3913
  var uniqueId = {
3914
3914
  value: 1
3915
3915
  };
3916
- function storiesFileName(testTitle) {
3916
+ function storiesFileName(testTitle, overwriteDuplicateNames = true) {
3917
+ let title = sanitize(testTitle);
3918
+ if (!overwriteDuplicateNames) {
3919
+ title += "-" + uniqueId.value++;
3920
+ }
3917
3921
  const fileName = [
3918
- sanitize(testTitle) + "-" + uniqueId.value++,
3922
+ title,
3919
3923
  STORIES_FILE_EXT
3920
3924
  ].join(".");
3921
3925
  const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
@@ -4016,7 +4020,7 @@ function findDefaultViewport(viewports) {
4016
4020
  __name(findDefaultViewport, "findDefaultViewport");
4017
4021
 
4018
4022
  // ../shared/src/write-archive/index.ts
4019
- async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
4023
+ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
4020
4024
  const { titlePath, outputDir, pageUrl } = e2eTestInfo;
4021
4025
  const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
4022
4026
  // make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
@@ -4051,7 +4055,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
4051
4055
  const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
4052
4056
  await outputFile(join(archiveDir, snapshotFile), mappedSnapshot);
4053
4057
  }));
4054
- const storiesFile = storiesFileName(title);
4058
+ const storiesFile = storiesFileName(title, testRunner !== "vitest");
4055
4059
  const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
4056
4060
  await outputJSONFile(join(finalOutputDir, storiesFile), storiesJson);
4057
4061
  const errors = Object.entries(archive).filter(([, r]) => "error" in r);
@@ -4250,7 +4254,7 @@ var performChromaticSnapshot = /* @__PURE__ */ __name(async ({ page, delay, diff
4250
4254
  prefersReducedMotion,
4251
4255
  cropToViewport,
4252
4256
  ignoreSelectors
4253
- });
4257
+ }, "playwright");
4254
4258
  trackComplete();
4255
4259
  } finally {
4256
4260
  chromaticSnapshots.delete(testId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromatic-com/playwright",
3
- "version": "0.14.8",
3
+ "version": "0.14.9",
4
4
  "description": "Chromatic Visual Regression Testing for Playwright",
5
5
  "repository": {
6
6
  "type": "git",