@chromatic-com/cypress 0.12.7 → 0.12.8

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
@@ -3670,6 +3670,10 @@ var _ArchiveFile = class _ArchiveFile {
3670
3670
  if (!queryString)
3671
3671
  return pathname;
3672
3672
  const safeQueryString = this.hash(queryString);
3673
+ const extension = path2__default.default.extname(pathname);
3674
+ if (extension) {
3675
+ return `${pathname.substring(0, pathname.length - extension.length)}-${safeQueryString}${extension}`;
3676
+ }
3673
3677
  return `${pathname}-${safeQueryString}`;
3674
3678
  }
3675
3679
  truncateFileName(pathname) {
@@ -3910,9 +3914,13 @@ var STORIES_FILE_EXT = "stories.json";
3910
3914
  var uniqueId = {
3911
3915
  value: 1
3912
3916
  };
3913
- function storiesFileName(testTitle) {
3917
+ function storiesFileName(testTitle, overwriteDuplicateNames = true) {
3918
+ let title = sanitize(testTitle);
3919
+ if (!overwriteDuplicateNames) {
3920
+ title += "-" + uniqueId.value++;
3921
+ }
3914
3922
  const fileName = [
3915
- sanitize(testTitle) + "-" + uniqueId.value++,
3923
+ title,
3916
3924
  STORIES_FILE_EXT
3917
3925
  ].join(".");
3918
3926
  const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
@@ -4013,7 +4021,7 @@ function findDefaultViewport(viewports) {
4013
4021
  __name(findDefaultViewport, "findDefaultViewport");
4014
4022
 
4015
4023
  // ../shared/src/write-archive/index.ts
4016
- async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
4024
+ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
4017
4025
  const { titlePath, outputDir, pageUrl } = e2eTestInfo;
4018
4026
  const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
4019
4027
  // make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
@@ -4048,7 +4056,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
4048
4056
  const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
4049
4057
  await outputFile(path2.join(archiveDir, snapshotFile), mappedSnapshot);
4050
4058
  }));
4051
- const storiesFile = storiesFileName(title);
4059
+ const storiesFile = storiesFileName(title, testRunner !== "vitest");
4052
4060
  const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
4053
4061
  await outputJSONFile(path2.join(finalOutputDir, storiesFile), storiesJson);
4054
4062
  const errors = Object.entries(archive).filter(([, r]) => "error" in r);
@@ -4081,7 +4089,7 @@ var writeArchives = /* @__PURE__ */ __name(async ({ testTitlePath, domSnapshots,
4081
4089
  titlePath: testTitlePath,
4082
4090
  outputDir,
4083
4091
  pageUrl
4084
- }, allSnapshots, resourceArchive, chromaticStorybookParams);
4092
+ }, allSnapshots, resourceArchive, chromaticStorybookParams, "cypress");
4085
4093
  }, "writeArchives");
4086
4094
  var resourceArchiver = null;
4087
4095
  var host = "";
package/dist/index.mjs CHANGED
@@ -3663,6 +3663,10 @@ var _ArchiveFile = class _ArchiveFile {
3663
3663
  if (!queryString)
3664
3664
  return pathname;
3665
3665
  const safeQueryString = this.hash(queryString);
3666
+ const extension = path2.extname(pathname);
3667
+ if (extension) {
3668
+ return `${pathname.substring(0, pathname.length - extension.length)}-${safeQueryString}${extension}`;
3669
+ }
3666
3670
  return `${pathname}-${safeQueryString}`;
3667
3671
  }
3668
3672
  truncateFileName(pathname) {
@@ -3903,9 +3907,13 @@ var STORIES_FILE_EXT = "stories.json";
3903
3907
  var uniqueId = {
3904
3908
  value: 1
3905
3909
  };
3906
- function storiesFileName(testTitle) {
3910
+ function storiesFileName(testTitle, overwriteDuplicateNames = true) {
3911
+ let title = sanitize(testTitle);
3912
+ if (!overwriteDuplicateNames) {
3913
+ title += "-" + uniqueId.value++;
3914
+ }
3907
3915
  const fileName = [
3908
- sanitize(testTitle) + "-" + uniqueId.value++,
3916
+ title,
3909
3917
  STORIES_FILE_EXT
3910
3918
  ].join(".");
3911
3919
  const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
@@ -4006,7 +4014,7 @@ function findDefaultViewport(viewports) {
4006
4014
  __name(findDefaultViewport, "findDefaultViewport");
4007
4015
 
4008
4016
  // ../shared/src/write-archive/index.ts
4009
- async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
4017
+ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
4010
4018
  const { titlePath, outputDir, pageUrl } = e2eTestInfo;
4011
4019
  const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
4012
4020
  // make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
@@ -4041,7 +4049,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
4041
4049
  const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
4042
4050
  await outputFile(join(archiveDir, snapshotFile), mappedSnapshot);
4043
4051
  }));
4044
- const storiesFile = storiesFileName(title);
4052
+ const storiesFile = storiesFileName(title, testRunner !== "vitest");
4045
4053
  const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
4046
4054
  await outputJSONFile(join(finalOutputDir, storiesFile), storiesJson);
4047
4055
  const errors = Object.entries(archive).filter(([, r]) => "error" in r);
@@ -4074,7 +4082,7 @@ var writeArchives = /* @__PURE__ */ __name(async ({ testTitlePath, domSnapshots,
4074
4082
  titlePath: testTitlePath,
4075
4083
  outputDir,
4076
4084
  pageUrl
4077
- }, allSnapshots, resourceArchive, chromaticStorybookParams);
4085
+ }, allSnapshots, resourceArchive, chromaticStorybookParams, "cypress");
4078
4086
  }, "writeArchives");
4079
4087
  var resourceArchiver = null;
4080
4088
  var host = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromatic-com/cypress",
3
- "version": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "description": "Chromatic Visual Regression Testing for Cypress",
5
5
  "repository": {
6
6
  "type": "git",