I've had great luck using wallaby.js on client side JavaScript and I'd like to try to get it to work on my server side JavaScript. However, wallaby.js likes to spin up a lot of parallel web servers which causes problems for the tests because it keeps on throwing EADDRINUSE
errors.
The basic scaffolding of my project was done with the Yeoman angular-fullstack generator, so my server code sits in /server
and most of the methods are in /server/api
.
Thus far, I've managed to get it to kinda work with the following configuration:
module.exports = function () {
return {
files: [
'server/**/*.js',
{ pattern: 'server/**/*.spec.js', ignore: true }
],
tests: [
'server/**/*.spec.js'
],
env: {
type: 'node',
},
debug: true,
workers: {
initial: 1,
regular: 1,
recycle: false
}
};
};
Here you can see that I'm setting the number of wallaby workers to 1 and not allowing it to recycle workers. It works fine the first time through, but after I start to edit files I get occasional EADDRINUSE
errors.
Is there a preferred mechanism for using wallaby.js with express and avoiding it from spawning multiple test server processes all on the same port, thereby eliminating the EADDRINUSE
errors?