Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf126dcb

Browse files
committed
1 parent447f383 commitf126dcb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ rewire("./myModule.js") === rewire("./myModule.js"); // = false
216216

217217
This can especially be a problem if the module is not idempotent[like mongoose models](https://github.com/jhnns/rewire/issues/27).
218218

219+
**Globals are imported into the module's scope at the time of rewiring**<br>
220+
Since rewire imports all gobals into the module's scope at the time of rewiring, property changes on the`global` object after that are not recognized anymore. This is a[problem when using sinon's fake timers*after* you've called`rewire()`](http://stackoverflow.com/questions/34885024/when-using-rewire-and-sinon-faketimer-order-matters/36025128).
221+
219222
**Dot notation**<br>
220223
Although it is possible to use dot notation when calling`__set__`, it is strongly discouraged in most cases. For instance, writing`myModule.__set__("console.log", fn)` is effectively the same as just writing`console.log = fn`. It would be better to write:
221224

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp