Skip to content

Commit

Permalink
Put archives in the Cypress-written downloads directory
Browse files Browse the repository at this point in the history
  • Loading branch information
skitterm committed Nov 17, 2023
1 parent 33c87b3 commit fe259ab
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/cypress-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'fs';
import type { elementNode } from 'rrweb-snapshot';
import { writeTestResult } from '../write-archive';
import type { ChromaticStorybookParameters } from '../types';
Expand Down Expand Up @@ -39,9 +38,9 @@ const doArchive = async ({
await writeTestResult(
{
title: testTitle,
// doesn't matter what value we put here, as long as it's a subdirectory of where we want this to actually go
// this will store it at ./cypress/downloads (the last directory doesn't matter)
// TODO: change so we don't have to do this trickery
outputDir: './some',
outputDir: './cypress/downloads/some',
pageUrl,
},
allSnapshots,
Expand All @@ -56,15 +55,3 @@ export const archiveCypress = async (params: ArchiveParams): Promise<null> => {

return null;
};

/**
* To be run in the before:run Cypress command
* before:run only runs if Cypress is in non-interactive mode, e.g. "npx cypress run" (https://docs.cypress.io/api/plugins/before-run-api#Syntax)
*/
export const ensureCleanDirectory = () => {
const archivesPath = './chromatic-archives';
// remove archives directory so we have a fresh start with each run
if (fs.existsSync(archivesPath)) {
fs.rmSync(archivesPath, { recursive: true });
}
};

0 comments on commit fe259ab

Please sign in to comment.