After looking into it the error messages were sending me on a wild goose chase and i just wasn't exporting my server.
Same here. My test had
const { app } = require('./app');
and my app had
module.exports = app;
I had to change the app.js line to have curly braces like the test has:
module.exports = { app };