Skip to content

Commit

Permalink
split config options between generateOnly and platform
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskalmar committed Nov 17, 2023
1 parent b56facf commit 104e4a0
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,6 @@ export const BaseConfigSchema = z.object({
*/
browser: z.enum(['chromium', 'firefox', 'webkit']),

/**
* URL of the Lost Pixel API endpoint
* @default 'https://api.lost-pixel.com'
*/
lostPixelPlatform: z.string(),

/**
* API key for the Lost Pixel platform
*/
apiKey: z.string().optional(),

/**
* Enable Storybook mode
*/
Expand All @@ -239,24 +228,12 @@ export const BaseConfigSchema = z.object({
*/
customShots: CustomShotsSchema.optional(),

/**
* Path to the baseline image folder
* @default '.lostpixel/baseline/'
*/
imagePathBaseline: z.string(),

/**
* Path to the current image folder
* @default '.lostpixel/current/'
*/
imagePathCurrent: z.string(),

/**
* Path to the difference image folder
* @default '.lostpixel/difference/'
*/
imagePathDifference: z.string(),

/**
* Define custom breakpoints for all tests as width in pixels
* @default []
Expand All @@ -271,18 +248,6 @@ export const BaseConfigSchema = z.object({
*/
shotConcurrency: z.number(),

/**
* Number of concurrent screenshots to compare
* @default 10
*/
compareConcurrency: z.number(),

/**
* Which comparison engine to use for diffing images
* @default 'pixelmatch'
*/
compareEngine: z.enum(['pixelmatch', 'odiff']),

/**
* Timeouts for various stages of the test
*/
Expand Down Expand Up @@ -334,14 +299,6 @@ export const BaseConfigSchema = z.object({
*/
threshold: z.number(),

/**
* Whether to set the GitHub status check on process start or not
*
* Setting this option to `true` makes only sense if the repository settings have pending status checks disabled
* @default false
*/
setPendingStatusCheck: z.boolean(),

/**
* How often to retry a shot for a stable result
* @default 0
Expand Down Expand Up @@ -392,6 +349,17 @@ export const BaseConfigSchema = z.object({
});

const PlatformModeConfigSchema = BaseConfigSchema.extend({
/**
* URL of the Lost Pixel API endpoint
* @default 'https://api.lost-pixel.com'
*/
lostPixelPlatform: z.string(),

/**
* API key for the Lost Pixel platform
*/
apiKey: z.string().optional(),

/**
* Project ID
*/
Expand Down Expand Up @@ -426,6 +394,14 @@ const PlatformModeConfigSchema = BaseConfigSchema.extend({
* File path to event.json file
*/
eventFilePath: z.string().optional(),

/**
* Whether to set the GitHub status check on process start or not
*
* Setting this option to `true` makes only sense if the repository settings have pending status checks disabled
* @default false
*/
setPendingStatusCheck: z.boolean(),
});

const GenerateOnlyModeConfigSchema = BaseConfigSchema.extend({
Expand All @@ -438,6 +414,30 @@ const GenerateOnlyModeConfigSchema = BaseConfigSchema.extend({
* Flag that decides if process should exit if a difference is found
*/
failOnDifference: z.boolean().optional(),

/**
* Path to the baseline image folder
* @default '.lostpixel/baseline/'
*/
imagePathBaseline: z.string(),

/**
* Path to the difference image folder
* @default '.lostpixel/difference/'
*/
imagePathDifference: z.string(),

/**
* Number of concurrent screenshots to compare
* @default 10
*/
compareConcurrency: z.number(),

/**
* Which comparison engine to use for diffing images
* @default 'pixelmatch'
*/
compareEngine: z.enum(['pixelmatch', 'odiff']),
});

type BaseConfig = {
Expand Down

0 comments on commit 104e4a0

Please sign in to comment.