Validate that setSuiteProperty and setSpecProperty args are cloneable

This commit is contained in:
Steve Gravrock
2025-09-21 15:08:53 -07:00
parent 970cbdc69c
commit 7214ccd3dc
6 changed files with 74 additions and 2 deletions

View File

@@ -70,8 +70,12 @@ getJasmineRequireObj().Spec = function(j$) {
return this.result.properties[key];
}
// TODO: throw if the key or value is not structred cloneable
setSpecProperty(key, value) {
// Key and value will eventually be cloned during reporting. The error
// thrown at that point if they aren't cloneable isn't very helpful.
// Throw a better one now.
j$.util.assertStructuredCloneable(key, 'Key');
j$.util.assertStructuredCloneable(value, 'Value');
this.result.properties = this.result.properties || {};
this.result.properties[key] = value;
}