Commit 4ccf6ed6 authored by David Sveningsson's avatar David Sveningsson
Browse files

feat: add import `html-validate/jest` as a shortcut to the jest matchers

parent f3445274
Pipeline #116334609 passed with stages
in 10 minutes and 40 seconds
......@@ -7,10 +7,10 @@ title: Usage with Jest
`html-validate` comes with Jest support built-in.
In you test import `matchers`:
In you test import `html-validate/jest`:
```js
import "html-validate/build/matchers";
import "html-validate/jest";
```
This makes all the custom matchers available.
......@@ -50,6 +50,8 @@ If you need to override this (perhaps because the test-case isn't in the same fo
expect("<p></i>").toHTMLValidate(null, "path/to/my-file.html");
```
This can also be used to apply transformations to the markup.
Additionally, the `root` configuration property can be used to skip loading from `.htmlvalidate.json` but remember to actually include the rules you need:
```js
......
......@@ -29,6 +29,7 @@
"bin",
"build",
"elements",
"jest.{js,d.ts}",
"!*.snap",
"!*.spec.d.ts",
"!*.spec.js",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment