Skip to content

Commit

Permalink
remove defaults, perform validation only when token passed
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjwala committed Sep 12, 2023
1 parent d735eae commit d5b6a9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
5 changes: 3 additions & 2 deletions packages/config/src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ const ajv = new AJV({
keywords: [{
keyword: 'onlyAutomate',
error: {
message: 'Only valid for Automate type projects'
message: 'property only valid with Automate integration.'
},
code: cxt => {
let isAutomateProjectToken = (process.env.PERCY_TOKEN || '').split('_')[0] === 'auto';
if (!isAutomateProjectToken) {
// we do validation only when token is passed
if (!!process.env.PERCY_TOKEN && !isAutomateProjectToken) {
cxt.error();
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const configSchema = {
},
freezeAnimation: {
type: 'boolean',
default: false,
onlyAutomate: true
},
ignoreRegions: {
Expand All @@ -62,14 +61,12 @@ export const configSchema = {
properties: {
ignoreRegionSelectors: {
type: 'array',
default: [],
items: {
type: 'string'
}
},
ignoreRegionXpaths: {
type: 'array',
default: [],
items: {
type: 'string'
}
Expand All @@ -83,14 +80,12 @@ export const configSchema = {
properties: {
considerRegionSelectors: {
type: 'array',
default: [],
items: {
type: 'string'
}
},
considerRegionXPaths: {
type: 'array',
default: [],
items: {
type: 'string'
}
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export function percyAutomateRequestHandler(req, percy) {
req.body.options = merge([{
percyCSS: percy.config.snapshot.percyCSS,
freezeAnimation: percy.config.snapshot.freezeAnimation,
ignoreRegionSelectors: percy.config.snapshot.ignoreRegions.ignoreRegionSelectors,
ignoreRegionXpaths: percy.config.snapshot.ignoreRegions.ignoreRegionXpaths,
considerRegionSelectors: percy.config.snapshot.considerRegions.considerRegionSelectors,
considerRegionXPaths: percy.config.snapshot.considerRegions.considerRegionXPaths
ignoreRegionSelectors: percy.config.snapshot.ignoreRegions?.ignoreRegionSelectors,
ignoreRegionXpaths: percy.config.snapshot.ignoreRegions?.ignoreRegionXpaths,
considerRegionSelectors: percy.config.snapshot.considerRegions?.considerRegionSelectors,
considerRegionXPaths: percy.config.snapshot.considerRegions?.considerRegionXPaths,

Check failure on line 48 in packages/core/src/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Unexpected trailing comma
},
camelCasedOptions
], (path, prev, next) => {
Expand Down

0 comments on commit d5b6a9e

Please sign in to comment.