Also require setSpecProperty/setSuiteProperty args to be JSON serializable

This commit is contained in:
Steve Gravrock
2025-09-27 15:40:19 -07:00
parent c2ce55580c
commit e11f320df3
5 changed files with 42 additions and 12 deletions

View File

@@ -80,9 +80,12 @@ getJasmineRequireObj().util = function(j$) {
}
};
util.assertStructuredCloneable = function(v, msgPrefix) {
util.assertReporterCloneable = function(v, msgPrefix) {
try {
structuredClone(v);
// Reporter events are cloned internally via structuredClone, and it's
// common for reporters (including jasmine-browser-runner's) to JSON
// serialize them.
JSON.stringify(structuredClone(v));
} catch (e) {
throw new Error(`${msgPrefix} can't be cloned`, { cause: e });
}