console-testing-library
Advanced tools
Comparing version 0.2.2 to 0.3.0
{ | ||
"name": "console-testing-library", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Testing console the right way", | ||
"type": "module", | ||
"main": "dist/console-testing-library.js", | ||
"main": "dist/index.js", | ||
"typings": "index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "dist/console-testing-library.js", | ||
"default": "index.js" | ||
"require": "dist/index.js", | ||
"default": "src/index.js" | ||
}, | ||
"./pure": { | ||
"require": "dist/pure.js", | ||
"default": "src/pure.js" | ||
} | ||
@@ -19,3 +23,3 @@ }, | ||
"scripts": { | ||
"build": "babel index.js -o dist/console-testing-library.js", | ||
"build": "babel src -d dist", | ||
"test": "jest", | ||
@@ -22,0 +26,0 @@ "prepare": "yarn build && yarn test" |
@@ -179,2 +179,18 @@ # `console-testing-library` | ||
## Manually mocking with Jest | ||
If your tests run with Jest then the `global.console` is automatically mocked. If you wish to have more control and manually mock it, then import the package from `pure` entry. | ||
```js | ||
import { createConsole, mockConsole } from 'console-testing-library/pure'; | ||
let restore = () => {}; | ||
beforeEach(() => { | ||
restore = mockConsole(createConsole()); | ||
}); | ||
afterEach(() => restore()); | ||
``` | ||
## Custom matchers | ||
@@ -181,0 +197,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25325
9
482
246
1