Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Fixes syntactically invalid JavaScript #1525

Merged
merged 2 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/Dredd.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ function prefixErrors(decoratedCallback, prefix) {


function readLocations(locations, options, callback) {
if (typeof options === 'function') { [options, callback] = [{}, options]; }
const usesOptions = typeof options !== 'function';
const resolvedOptions = usesOptions ? options : {};
const resolvedCallback = usesOptions ? callback : options;

async.map(locations, (location, next) => {
const decoratedNext = prefixErrors(next, `Unable to load API description document from '${location}'`);
readLocation(location, options, decoratedNext);
readLocation(location, resolvedOptions, decoratedNext);
}, (error, contents) => {
if (error) { callback(error); return; }
if (error) { resolvedCallback(error); return; }

const apiDescriptions = locations
.map((location, i) => ({ location, content: contents[i] }));
callback(null, apiDescriptions);
resolvedCallback(null, apiDescriptions);
});
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Hooks {
this.beforeEachValidation = this.beforeEachValidation.bind(this);
this.afterEach = this.afterEach.bind(this);
this.log = this.log.bind(this);
({ logs: this.logs, logger: this.logger } = options);
this.logs = options.logs;
this.logger = options.logger;
this.beforeHooks = {};
this.beforeValidationHooks = {};
this.afterHooks = {};
Expand Down