Skip to content

Commit

Permalink
fix: swallowed errors on nested schema with no tests
Browse files Browse the repository at this point in the history
fixes #1127
  • Loading branch information
jquense committed Nov 29, 2020
1 parent 6347b9a commit 5316ab9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/util/runTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ export default function runTests(options, cb) {
let callback = once(cb);
let count = tests.length;

if (!count) return callback(null, value);

const nestedErrors = [];
errors = errors ? errors : [];

if (!count)
return errors.length
? callback(new ValidationError(errors, value, path))
: callback(null, value);

for (let i = 0; i < tests.length; i++) {
const test = tests[i];

Expand Down

0 comments on commit 5316ab9

Please sign in to comment.