Skip to content

Commit

Permalink
make folder creation mode dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskalmar committed Nov 18, 2023
1 parent ecf47d9 commit 24d5713
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { v4 as uuid } from 'uuid';
import { type BrowserType, chromium, firefox, webkit } from 'playwright-core';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { config } from './config';
import { config, isPlatformModeConfig } from './config';
import { log } from './log';
import type { ShotItem } from './types';

Expand Down Expand Up @@ -126,11 +126,13 @@ export const extendFileName = ({ fileName, extension }: ExtendFileName) => {
};

export const createShotsFolders = () => {
const paths = [
config.imagePathBaseline,
config.imagePathCurrent,
config.imagePathDifference,
];
const paths = isPlatformModeConfig(config)
? [config.imagePathCurrent]
: [
config.imagePathBaseline,
config.imagePathCurrent,
config.imagePathDifference,
];

for (const path of paths) {
if (!existsSync(path)) {
Expand All @@ -139,7 +141,7 @@ export const createShotsFolders = () => {
}

const ignoreFile = normalize(
join(config.imagePathBaseline, '..', '.gitignore'),
join(config.imagePathCurrent, '..', '.gitignore'),
);

if (!existsSync(ignoreFile)) {
Expand Down

0 comments on commit 24d5713

Please sign in to comment.