You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-12Lines changed: 18 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ rewire
4
4
5
5
rewire adds a special setter and getter to modules so you can modify their behaviour for better unit testing. You may
6
6
7
-
- inject mocks for other modules
7
+
- inject mocks for other modules or globals like`process`
8
8
- leak private variables
9
9
- override variables within the module.
10
10
11
11
rewire does**not** load the file and eval the contents to emulate node's require mechanism. In fact it uses node's own require to load the module. Thus your module behaves exactly the same in your test environment as under regular circumstances (except your modifications).
12
12
13
-
Furthermorerewirecomes also withsupport for various client-side bundlers (see[below](#client-side-bundlers)).
13
+
Good news to all caffeine-addicts:rewireworks also with[Coffee-Script](http://coffeescript.org/). Note that in this case CS needs to be listed in your devDependencies.
@@ -130,31 +130,31 @@ Returns the private variable.
130
130
<br />
131
131
132
132
##Client-Side Bundlers
133
-
Since rewire relies heavily on node's require mechanism it can't be used on the client-side without adding special middleware to the bundling process. Currently supported bundlers are:
rewire comes also with support for client-side bundlers. But since it relies heavily on node's require mechanism it can't be used on the client-side without adding special middleware to the bundling process. Currently supported bundlers are:
However, expect this feature to be extracted into own bundler-specific modules soon.
137
140
138
141
**Please note:** Unfortunately the line numbers in stack traces have an offset of +2 (browserify) / +1 (webpack).
139
142
This is caused by generated code that is added during the bundling process.
140
143
141
144
###browserify
142
145
146
+
rewire currently only supportsbrowserify@1.x. I'm not planing to continue development, but if you're relying on this feature[please let me know](https://github.com/jhnns/rewire/issues/13).