Skip to content

Commit 96b8426

Browse files
fix(test): avoid JSON.stringify on OpenAPI schema in API assertion
OpenAPI schema objects can contain circular references after resolution. JSON.stringify threw when formatting the assert message; use util.inspect instead so failure output stays safe and readable.
1 parent 8547d87 commit 96b8426

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ describe('API', async () => {
700700
return;
701701
}
702702

703-
assert(schema[prop], `"${prop}" was found in response, but is not defined in schema (path: ${method} ${path}, context: ${context}), SCHEMA ${JSON.stringify(schema)}`);
703+
assert(schema[prop], `"${prop}" was found in response, but is not defined in schema (path: ${method} ${path}, context: ${context}), SCHEMA ${util.inspect(schema, { depth: 2, maxArrayLength: 20 })}`);
704704
});
705705
}
706706
});

0 commit comments

Comments
 (0)