Here are my before functions in my tests :
import mongoose from 'mongoose';
var Mockgoose = require('mockgoose').Mockgoose;
[...]
const mockgoose = new Mockgoose(mongoose);
before(function(done) {
try {
console.log('BEFORE prepareStorage');
mockgoose.prepareStorage().then(() => {
console.log('IN prepareStorage');
mongoose.connect('mongodb://example.com/TestingDB', function(err) {
done(err);
});
}).catch((error) => {
done(error);
});
} catch(e) {
done(e);
}
console.log('AFTER prepareStorage');
});
beforeEach(function(done) {
mockgoose.helper.reset();
done();
});
When I run the tests, during the mockgoose.prepareStorage
step, mockgoose seems to be downloading something.BEFORE prepareStorage
AFTER prepareStorage
Completed: 0.1 % (0.2mb / 234.3mb
I guess it has something to do with the requested 2 minutes timeout.My questions / problems are :
-
Does anybody know what mockgoose is downloading ? (I don't remember this behaviour with previous versions of mockgoose)
-
Does mockgoose need this download at each run (npm test) or will the result be reused in the next runs (npm test) ?
-
Can I prevent him to download something. Ideally, I would like to run my unit test in a sandbox env, with no access to the web (in a docker). Can I download the 234mb somewhere and ask mockgoose to reuse it ?
via Julien TASSIN
No comments:
Post a Comment