rewiremock
Advanced tools
Comparing version 3.10.1 to 3.10.2
@@ -1,1 +0,1 @@ | ||
module.export = require('./lib/babel'); | ||
module.exports = require('./lib/babel'); |
{ | ||
"name": "rewiremock", | ||
"version": "3.10.1", | ||
"version": "3.10.2", | ||
"description": "Advanced dependency mocking device.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -163,5 +163,20 @@ # rewiremock | ||
1. Add `rewiremock/babel' into plugin section in `.babelrc` | ||
### Limitations | ||
- This babel plugin __does not work__ if "modules" are not handled by babel. Ie in case of webpack harmony imports. | ||
- Other babel plugins, including JSX, does not work inside webpack _hoisted_ code. | ||
1. Add `rewiremock/babel` into plugin section in `.babelrc` | ||
```js | ||
// .babelrc | ||
{ | ||
"presets": [ | ||
//..... | ||
], | ||
"plugins": [ | ||
"rewiremock/babel" | ||
] | ||
} | ||
``` | ||
2. This example will be transpiled into | ||
```jsjs | ||
```js | ||
import sinon from 'sinon'; | ||
@@ -185,4 +200,4 @@ import rewiremock from 'rewiremock'; | ||
Keep in mind - rewiremock will hoist mock definition next to rewiremock import. | ||
- You can use anything above rewiremock import | ||
- You can mock anything below rewiremock import | ||
- You can __use__ anything __above__ rewiremock import | ||
- You can __mock__ anything __below__ rewiremock import | ||
@@ -189,0 +204,0 @@ ### Changing the mocks after the mocking |
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
165197
696