Mocha.js: before, beforeEach, after, afterEach

You can use before these to setup and restore any test helpers or components. You can even call these agains in nested describe.

describe('My feature test', function() {
    let classToTest;
    beforeEach(function() {
        classToTest = new ClassToTest();
    afterEach(function() {
        classToTest = null;

Leave a Reply

Your email address will not be published.