You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having a bad time trying to know what is going on here.
I'm setting some integration tests with mocha & supertest.
My problem is that the time showed on each "it" block is not reliable.
If I copy paste the same test, always, the first test takes like 5 times more. I know this must be something Im missing here, but can't understand why.
I know about require cache issue, but I don't think is related with my problem.
This is my test:
varexpress=require('express');varsupertest=require('supertest');varshould=require('should');describe('dummy describe',function(){varapp,request;beforeEach(function(){app=express();app.get('/',function(req,res){res.send('hey');});request=supertest(app).get('/').set('User-Agent','my cool browser').set('Accept','text/plain');});it('should do a dummy test',function(done){request.end(function(err,res){res.status.should.equal(200);res.text.should.equal('hey');done();});});it('should do a dummy test',function(done){request.end(function(err,res){res.status.should.equal(200);res.text.should.equal('hey');done();});});});
Note that test is exactly the same.
This are my results:
Even more, if I add more tests (same test); I still get the same results:
I don't think this is a normal behaviour, since it don't give me a reliable metric.
So, question is who is caching here ? or why is this happening ?
Not sure if this issue is related with Mocha, supertest, node's http module, or what.
I am having a bad time trying to know what is going on here.
I'm setting some integration tests with mocha & supertest.
My problem is that the time showed on each "it" block is not reliable.
If I copy paste the same test, always, the first test takes like 5 times more. I know this must be something Im missing here, but can't understand why.
I know about require cache issue, but I don't think is related with my problem.
This is my test:
Note that test is exactly the same.
This are my results:
Even more, if I add more tests (same test); I still get the same results:
I don't think this is a normal behaviour, since it don't give me a reliable metric.
So, question is who is caching here ? or why is this happening ?
Not sure if this issue is related with Mocha, supertest, node's http module, or what.
Thanks in advance !
stack overflow question
The text was updated successfully, but these errors were encountered: