From 5316ab980c4185b3528f5ac78a012c5590e8e059 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 29 Nov 2020 10:06:45 -0500 Subject: [PATCH] fix: swallowed errors on nested schema with no tests fixes #1127 --- src/util/runTests.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/runTests.js b/src/util/runTests.js index fd8b19314..cf0c47b73 100644 --- a/src/util/runTests.js +++ b/src/util/runTests.js @@ -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];