Skip to content

Commit

Permalink
Fix of issue id percy#1674, reporting false positive invalid config w…
Browse files Browse the repository at this point in the history
…arning.
  • Loading branch information
navrkalmerck committed Jul 22, 2024
1 parent 5fed3bc commit de24556
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/config/src/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function load({
config = normalize(config, { overrides, schema: '/config' });
let errors = config && validate(config);

if (errors) {
if (errors?.length > 0) {
log.warn('Invalid config:');
for (let e of errors) log.warn(`- ${e.path}: ${e.message}`);
if (bail) return;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/percy.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Percy {
// validate provided config options
let errors = PercyConfig.validate(config);

if (errors) {
if (errors?.length > 0) {
this.log.warn('Invalid config:');
for (let e of errors) this.log.warn(`- ${e.path}: ${e.message}`);
}
Expand Down Expand Up @@ -386,7 +386,7 @@ export class Percy {
let { clientInfo, environmentInfo, ...comparison } = options;
let errors = PercyConfig.validate(comparison, '/comparison');

if (errors) {
if (errors?.length > 0) {
this.log.warn('Invalid upload options:');
for (let e of errors) this.log.warn(`- ${e.path}: ${e.message}`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function validateSnapshotOptions(options) {
// warn on validation errors
let errors = PercyConfig.validate(migrated, schema);

if (errors) {
if (errors?.length > 0) {
log.warn('Invalid snapshot options:');
for (let e of errors) log.warn(`- ${e.path}: ${e.message}`);
}
Expand Down

0 comments on commit de24556

Please sign in to comment.