jest-validate
Advanced tools
+84
-5
@@ -7,6 +7,85 @@ /** | ||
| */ | ||
| export { ValidationError, createDidYouMeanMessage, format, logValidationWarning, } from './utils'; | ||
| export type { DeprecatedOptions } from './types'; | ||
| export { default as validate } from './validate'; | ||
| export { default as validateCLIOptions } from './validateCLIOptions'; | ||
| export { multipleValidOptions } from './condition'; | ||
| import type {Config} from '@jest/types'; | ||
| import type {Options} from 'yargs'; | ||
| export declare const createDidYouMeanMessage: ( | ||
| unrecognized: string, | ||
| allowedOptions: Array<string>, | ||
| ) => string; | ||
| declare type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string; | ||
| export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>; | ||
| export declare const format: (value: unknown) => string; | ||
| export declare const logValidationWarning: ( | ||
| name: string, | ||
| message: string, | ||
| comment?: string | null | undefined, | ||
| ) => void; | ||
| export declare function multipleValidOptions<T extends Array<unknown>>( | ||
| ...args: T | ||
| ): T[number]; | ||
| declare type Title = { | ||
| deprecation?: string; | ||
| error?: string; | ||
| warning?: string; | ||
| }; | ||
| export declare const validate: ( | ||
| config: Record<string, unknown>, | ||
| options: ValidationOptions, | ||
| ) => { | ||
| hasDeprecationWarnings: boolean; | ||
| isValid: boolean; | ||
| }; | ||
| export declare function validateCLIOptions( | ||
| argv: Config.Argv, | ||
| options: { | ||
| deprecationEntries: DeprecatedOptions; | ||
| [s: string]: Options; | ||
| }, | ||
| rawArgv?: Array<string>, | ||
| ): boolean; | ||
| export declare class ValidationError extends Error { | ||
| name: string; | ||
| message: string; | ||
| constructor(name: string, message: string, comment?: string | null); | ||
| } | ||
| declare type ValidationOptions = { | ||
| comment?: string; | ||
| condition?: (option: unknown, validOption: unknown) => boolean; | ||
| deprecate?: ( | ||
| config: Record<string, unknown>, | ||
| option: string, | ||
| deprecatedOptions: DeprecatedOptions, | ||
| options: ValidationOptions, | ||
| ) => boolean; | ||
| deprecatedConfig?: DeprecatedOptions; | ||
| error?: ( | ||
| option: string, | ||
| received: unknown, | ||
| defaultValue: unknown, | ||
| options: ValidationOptions, | ||
| path?: Array<string>, | ||
| ) => void; | ||
| exampleConfig: Record<string, unknown>; | ||
| recursive?: boolean; | ||
| recursiveDenylist?: Array<string>; | ||
| title?: Title; | ||
| unknown?: ( | ||
| config: Record<string, unknown>, | ||
| exampleConfig: Record<string, unknown>, | ||
| option: string, | ||
| options: ValidationOptions, | ||
| path?: Array<string>, | ||
| ) => void; | ||
| }; | ||
| export {}; |
+9
-19
@@ -50,16 +50,8 @@ 'use strict'; | ||
| function _defineProperty(obj, key, value) { | ||
| if (key in obj) { | ||
| Object.defineProperty(obj, key, { | ||
| value: value, | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true | ||
| }); | ||
| } else { | ||
| obj[key] = value; | ||
| } | ||
| return obj; | ||
| } | ||
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| const BULLET = _chalk().default.bold('\u25cf'); | ||
@@ -91,9 +83,7 @@ | ||
| class ValidationError extends Error { | ||
| name; | ||
| message; | ||
| constructor(name, message, comment) { | ||
| super(); | ||
| _defineProperty(this, 'name', void 0); | ||
| _defineProperty(this, 'message', void 0); | ||
| comment = comment ? '\n\n' + comment : '\n'; | ||
@@ -100,0 +90,0 @@ this.name = ''; |
+7
-7
| { | ||
| "name": "jest-validate", | ||
| "version": "27.5.1", | ||
| "version": "28.0.0-alpha.0", | ||
| "repository": { | ||
@@ -20,14 +20,14 @@ "type": "git", | ||
| "dependencies": { | ||
| "@jest/types": "^27.5.1", | ||
| "@jest/types": "^28.0.0-alpha.0", | ||
| "camelcase": "^6.2.0", | ||
| "chalk": "^4.0.0", | ||
| "jest-get-type": "^27.5.1", | ||
| "jest-get-type": "^28.0.0-alpha.0", | ||
| "leven": "^3.1.0", | ||
| "pretty-format": "^27.5.1" | ||
| "pretty-format": "^28.0.0-alpha.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/yargs": "^16.0.0" | ||
| "@types/yargs": "^17.0.8" | ||
| }, | ||
| "engines": { | ||
| "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" | ||
| "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" | ||
| }, | ||
@@ -37,3 +37,3 @@ "publishConfig": { | ||
| }, | ||
| "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" | ||
| "gitHead": "89275b08977065d98e42ad71fcf223f4ad169f09" | ||
| } |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| export declare function getValues<T = unknown>(validOption: T): Array<T>; | ||
| export declare function validationCondition(option: unknown, validOption: unknown): boolean; | ||
| export declare function multipleValidOptions<T extends Array<unknown>>(...args: T): T[number]; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { ValidationOptions } from './types'; | ||
| declare const validationOptions: ValidationOptions; | ||
| export default validationOptions; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { DeprecatedOptions, ValidationOptions } from './types'; | ||
| export declare const deprecationWarning: (config: Record<string, unknown>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { ValidationOptions } from './types'; | ||
| export declare const errorMessage: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: string[] | undefined) => void; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { ValidationOptions } from './types'; | ||
| declare const config: ValidationOptions; | ||
| export default config; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| declare type Title = { | ||
| deprecation?: string; | ||
| error?: string; | ||
| warning?: string; | ||
| }; | ||
| export declare type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string; | ||
| export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>; | ||
| export declare type ValidationOptions = { | ||
| comment?: string; | ||
| condition?: (option: unknown, validOption: unknown) => boolean; | ||
| deprecate?: (config: Record<string, unknown>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean; | ||
| deprecatedConfig?: DeprecatedOptions; | ||
| error?: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: Array<string>) => void; | ||
| exampleConfig: Record<string, unknown>; | ||
| recursive?: boolean; | ||
| recursiveDenylist?: Array<string>; | ||
| title?: Title; | ||
| unknown?: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: Array<string>) => void; | ||
| }; | ||
| export {}; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| export declare const DEPRECATION: string; | ||
| export declare const ERROR: string; | ||
| export declare const WARNING: string; | ||
| export declare const format: (value: unknown) => string; | ||
| export declare const formatPrettyObject: (value: unknown) => string; | ||
| export declare class ValidationError extends Error { | ||
| name: string; | ||
| message: string; | ||
| constructor(name: string, message: string, comment?: string | null); | ||
| } | ||
| export declare const logValidationWarning: (name: string, message: string, comment?: string | null | undefined) => void; | ||
| export declare const createDidYouMeanMessage: (unrecognized: string, allowedOptions: Array<string>) => string; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { ValidationOptions } from './types'; | ||
| declare let hasDeprecationWarnings: boolean; | ||
| declare const validate: (config: Record<string, unknown>, options: ValidationOptions) => { | ||
| hasDeprecationWarnings: boolean; | ||
| isValid: boolean; | ||
| }; | ||
| export default validate; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { Options } from 'yargs'; | ||
| import type { Config } from '@jest/types'; | ||
| import type { DeprecatedOptions } from './types'; | ||
| export declare const DOCUMENTATION_NOTE: string; | ||
| export default function validateCLIOptions(argv: Config.Argv, options: { | ||
| deprecationEntries: DeprecatedOptions; | ||
| [s: string]: Options; | ||
| }, rawArgv?: Array<string>): boolean; |
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| import type { ValidationOptions } from './types'; | ||
| export declare const unknownOptionWarning: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: string[] | undefined) => void; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28006
-12.36%15
-40%693
-8.21%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated