Comments (8)
Thanks for setting up the test case, that makes my life much easier! I'll take a look when I can.
from rewireify.
I haven't had time to set this up yet but looking at the code - have you tried switching exports
to module.exports
? Rewireify assigns the __get__
and __set__
properties on module.exports
which takes precedence over exports
(see here for more info).
from rewireify.
I've had a minute and managed a proper look. Downgrading Rewireify to 0.2.0 in your example app works. This version of Rewireify bundled an old version of the injected __set__
method from Rewire so this may be a bug may be within the Rewire dependency or Rewireify's integration with it.
from rewireify.
Thanks! (module.exports made no difference.)
By the way, I also added the issue over at Rewire: jhnns/rewire#70
I'm glad there is a workaround at least. I was going crazy since this seemed like such a common use case and I wondered what I was doing wrong.
from rewireify.
Are you able to run the test runner successfully in your browser (rather than through headless PhantomJS)? Mocking the methods of dependencies is covered in the test suite and is working as expected when in Chrome and Firefox.
from rewireify.
Function.prototype.bind
is undefined in PhantomJS 1.x (See ariya/phantomjs#13107)
from rewireify.
Thanks for taking a look @jhnns and figuring it out =D
from rewireify.
Thank you for figuring out what the problem was.
from rewireify.
Related Issues (14)
- Add __restore__ method HOT 2
- Does not seem to work with source mapping HOT 6
- Rewireify exposes __get__ and __set__ via Object.keys HOT 4
- 0.2.3 - methods aren't injected if typeof module.exports is 'function' HOT 3
- Sharing code between rewireify and rewire-global HOT 9
- rewireify with karma-browserify and watchify? HOT 2
- Problem ES6 module syntax HOT 1
- Rewire doesn't work when the module is a constructor function HOT 1
- Intermittent error attempting to define __get__ more than once on Karma startup. HOT 18
- Slashes in windows HOT 5
- module.__set__(map) errors when using nested properties HOT 5
- the "right" way of testing nested modules HOT 3
- Incompatibility with browserify-istanbul in karma HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rewireify.