Skip to content

Commit baff5d4

Browse files
fix: continueOnError behaves correctly with empty parsing result
1 parent 2c75399 commit baff5d4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function parseFile (file, options, $refs) {
124124
.then(onParsed, onError);
125125

126126
function onParsed (parser) {
127-
if ((options.continueOnError || !parser.plugin.allowEmpty) && isEmpty(parser.result)) {
127+
if (!options.continueOnError && !parser.plugin.allowEmpty && isEmpty(parser.result)) {
128128
reject(ono.syntax(`Error parsing "${file.url}" as ${parser.plugin.name}. \nParsed value is empty`));
129129
}
130130
else {

test/specs/parsers/parsers.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe("References to non-JSON files", () => {
206206
}
207207
});
208208

209-
it("should throw a grouped error if no parser can be matched and fastFail is false", async () => {
209+
it("should throw a grouped error if no parser can be matched and continueOnError is true", async () => {
210210
try {
211211
const parser = new $RefParser();
212212
await parser.dereference(path.rel("specs/parsers/parsers.yaml"), {

0 commit comments

Comments
 (0)