jest-validate
Advanced tools
Comparing version 21.3.0-beta.8 to 21.3.0-beta.9
{ | ||
"name": "jest-validate", | ||
"version": "21.3.0-beta.8", | ||
"version": "21.3.0-beta.9", | ||
"repository": { | ||
@@ -12,6 +12,6 @@ "type": "git", | ||
"chalk": "^2.0.1", | ||
"jest-get-type": "21.3.0-beta.8", | ||
"jest-get-type": "21.3.0-beta.9", | ||
"leven": "^2.1.0", | ||
"pretty-format": "21.3.0-beta.8" | ||
"pretty-format": "21.3.0-beta.9" | ||
} | ||
} |
# jest-validate | ||
Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration. | ||
Generic configuration validation tool that helps you with warnings, errors and | ||
deprecation messages as well as showing users examples of correct configuration. | ||
@@ -14,9 +15,7 @@ ``` | ||
validate( | ||
config: Object, | ||
options: ValidationOptions, | ||
); // => {hasDeprecationWarnings: boolean, isValid: boolean} | ||
validate((config: Object), (options: ValidationOptions)); // => {hasDeprecationWarnings: boolean, isValid: boolean} | ||
``` | ||
Where `ValidationOptions` are: | ||
```js | ||
@@ -30,3 +29,3 @@ type ValidationOptions = { | ||
deprecatedOptions: Object, | ||
options: ValidationOptions | ||
options: ValidationOptions, | ||
) => true, | ||
@@ -46,5 +45,5 @@ deprecatedConfig?: {[key: string]: Function}, | ||
option: string, | ||
options: ValidationOptions | ||
options: ValidationOptions, | ||
) => void, | ||
} | ||
}; | ||
@@ -55,3 +54,3 @@ type Title = {| | ||
warning?: string, | ||
|} | ||
|}; | ||
``` | ||
@@ -63,3 +62,5 @@ | ||
By default `jest-validate` will print generic warning and error messages. You can however customize this behavior by providing `options: ValidationOptions` object as a second argument: | ||
By default `jest-validate` will print generic warning and error messages. You | ||
can however customize this behavior by providing `options: ValidationOptions` | ||
object as a second argument: | ||
@@ -72,8 +73,11 @@ Almost anything can be overwritten to suite your needs. | ||
* `condition` – an optional function with validation condition. | ||
* `deprecate`, `error`, `unknown` – optional functions responsible for displaying warning and error messages. | ||
* `deprecate`, `error`, `unknown` – optional functions responsible for | ||
displaying warning and error messages. | ||
* `deprecatedConfig` – optional object with deprecated config keys. | ||
* `exampleConfig` – the only **required** option with configuration against which you'd like to test. | ||
* `exampleConfig` – the only **required** option with configuration against | ||
which you'd like to test. | ||
* `title` – optional object of titles for errors and messages. | ||
You will find examples of `condition`, `deprecate`, `error`, `unknown`, and `deprecatedConfig` inside source of this repository, named respectively. | ||
You will find examples of `condition`, `deprecate`, `error`, `unknown`, and | ||
`deprecatedConfig` inside source of this repository, named respectively. | ||
@@ -134,4 +138,6 @@ ## Examples | ||
#### Deprecation | ||
Based on `deprecatedConfig` object with proper deprecation messages. Note custom title: | ||
Based on `deprecatedConfig` object with proper deprecation messages. Note custom | ||
title: | ||
``` | ||
@@ -138,0 +144,0 @@ Custom Deprecation: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150
21203
12
+ Addedjest-get-type@21.3.0-beta.9(transitive)
+ Addedpretty-format@21.3.0-beta.9(transitive)
- Removedjest-get-type@21.3.0-beta.8(transitive)
- Removedpretty-format@21.3.0-beta.8(transitive)
Updatedjest-get-type@21.3.0-beta.9
Updatedpretty-format@21.3.0-beta.9