Skip to content

Commit 8a5c4d5

Browse files
authored
Remove recursiveBlacklist option from jest-validate (#10650)
1 parent 5e2e8ed commit 8a5c4d5

5 files changed

Lines changed: 6 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
- `[jest-runner]` [**BREAKING**] Migrate to ESM ([#10900](https://github.com/facebook/jest/pull/10900))
5454
- `[jest-runtime]` [**BREAKING**] Remove deprecated and unnused `getSourceMapInfo` from Runtime ([#9969](https://github.com/facebook/jest/pull/9969))
5555
- `[jest-util]` No longer checking `enumerable` when adding `process.domain` ([#10862](https://github.com/facebook/jest/pull/10862))
56+
- `[jest-validate]` [**BREAKING**] Remove `recursiveBlacklist ` option in favor of previously introduced `recursiveDenylist` ([#10650](https://github.com/facebook/jest/pull/10650))
5657

5758
### Performance
5859

packages/jest-config/src/normalize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ export default function normalize(
553553
comment: DOCUMENTATION_NOTE,
554554
deprecatedConfig: DEPRECATED_CONFIG,
555555
exampleConfig: VALID_CONFIG,
556-
recursiveBlacklist: [
556+
recursiveDenylist: [
557557
'collectCoverageOnlyFrom',
558558
// 'coverageThreshold' allows to use 'global' and glob strings on the same
559559
// level, there's currently no way we can deal with such config

packages/jest-validate/src/__tests__/validate.test.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -100,40 +100,6 @@ test.each([
100100
},
101101
);
102102

103-
test('respects recursiveBlacklist', () => {
104-
const warn = console.warn;
105-
console.warn = jest.fn();
106-
const config = {
107-
something: {
108-
nested: {
109-
some_random_key: 'value',
110-
some_random_key2: 'value2',
111-
},
112-
},
113-
};
114-
const exampleConfig = {
115-
something: {
116-
nested: {
117-
test: true,
118-
},
119-
},
120-
};
121-
122-
validate(config, {exampleConfig});
123-
124-
expect(console.warn).toBeCalled();
125-
126-
console.warn.mockReset();
127-
128-
validate(config, {
129-
exampleConfig,
130-
recursiveBlacklist: ['something.nested'],
131-
});
132-
133-
expect(console.warn).not.toBeCalled();
134-
console.warn = warn;
135-
});
136-
137103
test('respects recursiveDenylist', () => {
138104
const warn = console.warn;
139105
console.warn = jest.fn();

packages/jest-validate/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export type ValidationOptions = {
3434
) => void;
3535
exampleConfig: Record<string, unknown>;
3636
recursive?: boolean;
37-
recursiveBlacklist?: Array<string>;
3837
recursiveDenylist?: Array<string>;
3938
title?: Title;
4039
unknown?: (

packages/jest-validate/src/validate.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ const _validate = (
7070
options.error(key, config[key], exampleConfig[key], options, path);
7171
}
7272
} else if (
73-
shouldSkipValidationForPath(
74-
path,
75-
key,
76-
options.recursiveDenylist || options.recursiveBlacklist,
77-
)
73+
shouldSkipValidationForPath(path, key, options.recursiveDenylist)
7874
) {
7975
// skip validating unknown options inside blacklisted paths
8076
} else {
@@ -85,12 +81,8 @@ const _validate = (
8581
if (
8682
options.recursive &&
8783
!Array.isArray(exampleConfig[key]) &&
88-
(options.recursiveDenylist || options.recursiveBlacklist) &&
89-
!shouldSkipValidationForPath(
90-
path,
91-
key,
92-
options.recursiveDenylist || options.recursiveBlacklist,
93-
)
84+
options.recursiveDenylist &&
85+
!shouldSkipValidationForPath(path, key, options.recursiveDenylist)
9486
) {
9587
_validate(config[key], exampleConfig[key], options, [...path, key]);
9688
}
@@ -112,7 +104,7 @@ const validate = (
112104
// Preserve default denylist entries even with user-supplied denylist
113105
const combinedDenylist: Array<string> = [
114106
...(defaultConfig.recursiveDenylist || []),
115-
...(options.recursiveDenylist || options.recursiveBlacklist || []),
107+
...(options.recursiveDenylist || []),
116108
];
117109

118110
const defaultedOptions: ValidationOptions = Object.assign({

0 commit comments

Comments
 (0)