|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
638 bytes
|
| Line | |
|---|
| 1 | # babel-plugin-jest-hoist
|
|---|
| 2 |
|
|---|
| 3 | Babel plugin to hoist `jest.disableAutomock`, `jest.enableAutomock`, `jest.unmock`, `jest.mock`, calls above `import` statements. This plugin is automatically included when using [babel-jest](https://github.com/facebook/jest/tree/main/packages/babel-jest).
|
|---|
| 4 |
|
|---|
| 5 | ## Installation
|
|---|
| 6 |
|
|---|
| 7 | ```sh
|
|---|
| 8 | $ yarn add --dev babel-plugin-jest-hoist
|
|---|
| 9 | ```
|
|---|
| 10 |
|
|---|
| 11 | ## Usage
|
|---|
| 12 |
|
|---|
| 13 | ### Via `babel.config.js` (Recommended)
|
|---|
| 14 |
|
|---|
| 15 | ```js
|
|---|
| 16 | module.exports = {
|
|---|
| 17 | plugins: ['jest-hoist'],
|
|---|
| 18 | };
|
|---|
| 19 | ```
|
|---|
| 20 |
|
|---|
| 21 | ### Via CLI
|
|---|
| 22 |
|
|---|
| 23 | ```sh
|
|---|
| 24 | $ babel --plugins jest-hoist script.js
|
|---|
| 25 | ```
|
|---|
| 26 |
|
|---|
| 27 | ### Via Node API
|
|---|
| 28 |
|
|---|
| 29 | ```javascript
|
|---|
| 30 | require('@babel/core').transform('code', {
|
|---|
| 31 | plugins: ['jest-hoist'],
|
|---|
| 32 | });
|
|---|
| 33 | ```
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.