diff --git a/packages/config/src/load.js b/packages/config/src/load.js index 730c1d324..34e76bab7 100644 --- a/packages/config/src/load.js +++ b/packages/config/src/load.js @@ -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; diff --git a/packages/core/src/percy.js b/packages/core/src/percy.js index f1449cf9c..7a350f7ed 100644 --- a/packages/core/src/percy.js +++ b/packages/core/src/percy.js @@ -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}`); } @@ -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}`); } diff --git a/packages/core/src/snapshot.js b/packages/core/src/snapshot.js index 7a5b11533..ee192ccbb 100644 --- a/packages/core/src/snapshot.js +++ b/packages/core/src/snapshot.js @@ -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}`); }