-
Notifications
You must be signed in to change notification settings - Fork 60
Bad cache restore for addon modules #34
Comments
I have the same issue when using java bridge for node (node-java). Disabling the |
Disabling |
My guess is that native modules can only be loaded once. When mockery clears the cache, node tries to load the native module a second time since it's not in cache. However, the native module doesn't "self-register" a second time because it knows it's already been loaded once. To fix this, mockery can cache ".node" modules in node's original cache even when This fix would be a problem if ".node" modules required other modules, but I'm pretty sure that doesn't happen. |
Hi there, Any chance you'll fix this in mockery ? Thx |
… while running midway tests mfncooper/mockery#34
Mockery's restoration of the cache on disable() seems inadequate for addon modules.
I'm using Windows 7, SP2, 64bit, node 0.12.4 (32 bit) and Mockery 1.4.0.
Clone node-addon-examples and add a couple of javascript files to the root folder of the first example:
node-addon-examples\1_hello_world\node_0.12
.File 1: tock.js (12 lines)
File 2: tick.js (1 line)
In a command window, cd to the root folder and run the following commands.
The output was the following.
If we alter the code to turn off
useCleanCache
or if we uncomment the line toregisterSubstitute()
and rerun, then it runs without error.I tried a similar test on other examples in this repo of addon examples, with similar results.
The text was updated successfully, but these errors were encountered: