javascript - Proxyquire can't find module -


i'm trying use proxyquire mock dependency testing. keep getting error cannot find module

i tried full path , it's still complaining.

i have src file in assets/js/src/lib , test in js-tests/specs

here's code.

var proxyquire = require('proxyquireify')(require); var stubs = {    'mandrill': {        mandrill: function () {            return {               messages : jasmine.createspy('send')           };       }   } };  var jquery = require('jquery'),     mandrill = proxyquire('../../assets/js/src/lib/mandrill', stubs),     globalmandrill = require('mandrill'); 

which i'm getting error.

error: cannot find module '../../assets/js/src/lib/mandrill' at

i'm using grunt , phantomjs run tests

here's browserify in gruntfile.js

browserify : {     options: {         prebundlecb: function(b) {             b.plugin(remapify, [                    // module config              ]);          }     },     dist: {         files : {             // files         },         options: {             transform: ['browserify-shim']         }     },     specs : {         src : ['js-tests/specs/**/*.js'],         dest : 'js-tests/build/specs.js',         options: {             transform: ["browserify-shim"]         },     }  }, 

try adding plugin: ['proxyquireify/plugin'] specs.options object


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -