I started to use mocha programmatically, which means I run the test suite every time when I request the resouce localhost:3000/tests/start.
app.get('/tests/start', (req, res) => {
var mocha = new Mocha({
reporter: 'json'
});
mocha.useColors(false);
config.tests.forEach(test => {
if(test.enabled)
mocha.addFile('./test/cases/' + test.filename + '.js')
});
mocha.run(function(failures){
console.log(failures);
res.send();
});
});
If I start node and call localhost:3000/tests/start everything works fine and my tests pass. But when I call the same resouce later again, I get only that feedback:
{
"stats": {
"suites": 0,
"tests": 0,
"passes": 0,
"pending": 0,
"failures": 0,
"start": "2017-04-10T14:54:14.322Z",
"end": "2017-04-10T14:54:14.322Z",
"duration": 0
},
"tests": [],
"pending": [],
"failures": [],
"passes": []
}
I thought REST is stateles... Do anyone know more about this "issue" or a good way to debug my application? Thanks!
via Fabian
No comments:
Post a Comment