Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Valcke <valcke_jeroen@hotmail.com>2017-10-20 21:06:42 +0300
committerJeroen Valcke <valcke_jeroen@hotmail.com>2017-10-20 21:06:42 +0300
commitc176d025b57ff616d2a63989a685fe70651e33d3 (patch)
tree73b1444260a6df8dd0d6193d24da81b204e38ec8 /README.md
parentbc5a74cd63200f89e2eb39f3bffbe27950afe63b (diff)
Update README
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index da42d46..03b2866 100644
--- a/README.md
+++ b/README.md
@@ -139,9 +139,6 @@ myModule.__with__({
Limitations
-----------
-**Using `const`**<br>
-It's not possible to rewire `const` (see [#79](https://github.com/jhnns/rewire/issues/79)). This can probably be solved with [proxies](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy) someday but requires further research.
-
**Transpilers**<br>
Some transpilers, like babel, rename variables in order to emulate certain language features. Rewire will not work in these cases (see [#62](https://github.com/jhnns/rewire/issues/62)). A possible solution might be switching to [babel-plugin-rewire](https://github.com/speedskater/babel-plugin-rewire).
@@ -182,10 +179,15 @@ Please be aware that you can't rewire `eval()` or the global object itself.
API
---
-### rewire(filename: String): rewiredModule
+### rewire(filename: String, [options]): rewiredModule
Returns a rewired version of the module found at `filename`. Use `rewire()` exactly like `require()`.
+#### Options
+| Property | Default | Description |
+|----------|---------|-------------|
+| convertConst | false | Set to true to convert all `const` variables of the required module to `let`. This way you can mock const variables. **Caution**: Setting this to true can lead to inaccurate tests.
+
### rewiredModule.&#95;&#95;set&#95;&#95;(name: String, value: *): Function
Sets the internal variable `name` to the given `value`. Returns a function which can be called to revert the change.