lundi 1 février 2016

Mocking a nested module in Node.js?

I have these files:

File1.js

var mod1 = require('mod1'); mod1.someFunction() ...

File2.js

var File1 = require('./File1');

Now while while writing unit tests for File2, is it possible to have mod1 mocked, so that I don't make calls to mod1.someFunction()?

Aucun commentaire:

Enregistrer un commentaire