Require spec/suite property keys to be strings, not just anything that's cloneable and serializable

This matches the jsdoc.
This commit is contained in:
Steve Gravrock
2025-10-18 17:22:48 -07:00
parent d66d0d9d2e
commit 4201fd848f
5 changed files with 32 additions and 22 deletions

View File

@@ -849,8 +849,11 @@ getJasmineRequireObj().Spec = function(j$) {
// 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$.private.util.assertReporterCloneable(key, 'Key');
if (!j$.private.isString(key)) {
throw new Error('Key must be a string');
}
j$.private.util.assertReporterCloneable(value, 'Value');
this.#executionState.properties = this.#executionState.properties || {};
this.#executionState.properties[key] = value;
}
@@ -10851,8 +10854,11 @@ getJasmineRequireObj().Suite = function(j$) {
// 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$.private.util.assertReporterCloneable(key, 'Key');
if (!j$.private.isString(key)) {
throw new Error('Key must be a string');
}
j$.private.util.assertReporterCloneable(value, 'Value');
this.#result.properties = this.#result.properties || {};
this.#result.properties[key] = value;
}