Skip to content

Commit

Permalink
🐛 Fix fallback and assert when widths is provided but empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wwilsman committed Jul 31, 2020
1 parent 0d9106d commit eb07c01
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/percy.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ export default class Percy {
assert(domSnapshot, 'Missing required argument: domSnapshot');

// fallback to instance snapshot widths
widths = widths ?? this.config.snapshot.widths;
assert(widths, 'Missing required argument: widths');
widths = widths?.length ? widths : this.config.snapshot.widths;
assert(widths?.length, 'Missing required argument: widths');
assert(widths.length <= 10, 'too many widths');

// normalize the URL
url = normalizeURL(url);
// fallback to instance minimum height
minimumHeight = minimumHeight ?? this.config.snapshot.minimumHeight;
// combine snapshot Percy CSS with instance Percy CSS
percyCSS = `${this.config.snapshot.percyCSS}\n${percyCSS ?? ''}`.trim();
percyCSS = [this.config.snapshot.percyCSS, percyCSS].filter(Boolean).join('\n');
// combine snapshot request headers with instance request headers
requestHeaders = { ...this.config.snapshot.requestHeaders, ...requestHeaders };
// fallback to instance enable JS flag
Expand Down

0 comments on commit eb07c01

Please sign in to comment.