Treat {verboseDeprecations: undefined} as a no-op, like other boolean config props

This commit is contained in:
Steve Gravrock
2025-09-14 09:51:21 -07:00
parent 4d3f6b272a
commit 3040abe23d
3 changed files with 6 additions and 37 deletions

View File

@@ -3406,7 +3406,8 @@ getJasmineRequireObj().Configuration = function(j$) {
'stopSpecOnExpectationFailure',
'autoCleanClosures',
'forbidDuplicateNames',
'detectLateRejectionHandling'
'detectLateRejectionHandling',
'verboseDeprecations'
];
for (const k of booleanProps) {
@@ -3423,12 +3424,6 @@ getJasmineRequireObj().Configuration = function(j$) {
if (typeof changes.seed !== 'undefined') {
this.#values.seed = changes.seed;
}
// TODO: in the next major release, make verboseDeprecations work like
// other boolean properties.
if (changes.hasOwnProperty('verboseDeprecations')) {
this.#values.verboseDeprecations = changes.verboseDeprecations;
}
}
}

View File

@@ -7,14 +7,10 @@ describe('Configuration', function() {
'hideDisabled',
'autoCleanClosures',
'forbidDuplicateNames',
'detectLateRejectionHandling'
];
const allKeys = [
...standardBooleanKeys,
'seed',
'specFilter',
'detectLateRejectionHandling',
'verboseDeprecations'
];
const allKeys = [...standardBooleanKeys, 'seed', 'specFilter'];
Object.freeze(standardBooleanKeys);
Object.freeze(allKeys);
@@ -86,23 +82,6 @@ describe('Configuration', function() {
});
}
// TODO: in the next major release, treat verboseDeprecations like other booleans
it('sets verboseDeprecations when present', function() {
const subject = new jasmineUnderTest.Configuration();
const orig = subject.verboseDeprecations;
subject.update({ verboseDeprecations: !orig });
expect(subject.verboseDeprecations).toEqual(!orig);
subject.update({ verboseDeprecations: orig });
expect(subject.verboseDeprecations).toEqual(orig);
// For backwards compatibility, explicitly setting to undefined should
// work. Undefined isn't officially valid but gets treated like false.
subject.update({ verboseDeprecations: undefined });
expect(subject.verboseDeprecations).toBeUndefined();
});
it('sets specFilter when truthy', function() {
const subject = new jasmineUnderTest.Configuration();
const orig = subject.specFilter;

View File

@@ -156,7 +156,8 @@ getJasmineRequireObj().Configuration = function(j$) {
'stopSpecOnExpectationFailure',
'autoCleanClosures',
'forbidDuplicateNames',
'detectLateRejectionHandling'
'detectLateRejectionHandling',
'verboseDeprecations'
];
for (const k of booleanProps) {
@@ -173,12 +174,6 @@ getJasmineRequireObj().Configuration = function(j$) {
if (typeof changes.seed !== 'undefined') {
this.#values.seed = changes.seed;
}
// TODO: in the next major release, make verboseDeprecations work like
// other boolean properties.
if (changes.hasOwnProperty('verboseDeprecations')) {
this.#values.verboseDeprecations = changes.verboseDeprecations;
}
}
}