In my RN application I am importing the following module:
const dismissKeyboard = require('dismissKeyboard'); /
import dismissKeyboard from 'dismissKeyboard';
When running tests I get the following error:
Error: Cannot find module 'dismissKeyboard'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (InputAccessory.js:12:25)
at Module._compile (module.js:413:34)
at loader (/Users/user/dev/app/node_modules/babel-register/lib/node.js:126:5)
I have tried with sinon:
before(() => {
sinon.stub('dismissKeyboard', () => {});
});
and also with mockey:
mockery.enable();
mockery.mock('dismissKeyboard', () => null) /
mockery.registerMock('dismissKeyboard', () => null)
But I still get the same error.
Any suggestions? The dismissKeyboard module is shipped with RN, but somehow being required separately. I am using mocha.
Aucun commentaire:
Enregistrer un commentaire