To keep your tests running even when the beforeEach () function throws an error, you need to handle this error. Currently, beforeEach () throws an error that is not being processed.
To handle this error in NodeJS, use the callback with the parameter:
beforeEach(done) { // your code here // if there was an error if (error !== null) { // callback with a parameter, indicates failure done(new Error('failed')); } else { // more code here // callback without parameter, indicates success! done(); } }
source share