Mocha tests missing in the Expresso capstone project

Hi folks!

I am working on the Expresso project from the web development skill path and I have noticed a problem with the tests to run to check my work.

At first, when I install the starting code the tests run just fine. But after some time suddenly not all of them show up when typing “npm test” in the console. Sometimes the number of them even changes, but’s it’s never all of them.

Any idea why it may be happening? Has anyone met this problem before?

Let me know =)

Small update: looks like the tests stop working when I comment the last line in server.js file, which is the export of the app module.

const express = require('express');
const errorHandler = require('errorhandler');

const apiRouter = require('./api/api');

const app = express();
const PORT = process.env.PORT || 4000;

app.use('/api', apiRouter);


app.listen(PORT, () => {
    console.log(`Listening on port ${PORT}`);

module.exports = app;

Another strange thing is, whatever I comment out or not, once the tests are done executing, control doesn’t go back to the command line but the console stays idle.

I think I am experiencing a similar issue in the x-press publishing project. I’ve started encountering this after starting to work on the issues routes. I haven’t worked out why it’s happening, and it only happens on some runs. By way of illustration, if I run the npm test again, without changing my code, I will sometimes get all the tests back, but I might lose some of the tests again upon a subsequent run.

EDIT: I found a separate thread for this issue here: X-Press Publishing project: Incomplete test results