Mochajs is a popular testing framework that can be executed in Node and the browser. Provide hook functions to support asynchronous testing (function(done), done() indicates notification of mochaJS test completion, async function), managed by only and SKIP. The code style is:

var assert = require('assert');
describe('Array'.function() {
    describe('#indexOf()'.function() {

        before(function () {
            console.log('before:');
        });

        after(function () {
            console.log('after.');
        });

        beforeEach(function () {
            console.log(' beforeEach:');
        });

        afterEach(function () {
            console.log(' afterEach.');
        });

        it('should return -1 when the value is not present'.function() {
          assert.equal([1.2.3].indexOf(4), -1);
        });
        
        it('#async with done'.(done) = >{(async function () {
                try {
                    let r = await hello();
                    assert.strictEqual(r, 15);
                    done();
                } catch (err) {
                    done(err);
                }
            })();
        });
        
        it('#test GET /'.async() = > {let res = await request(server)
                .get('/')
                .expect('Content-Type'./text\/html/)
                .expect(200.'

Hello, world!

'
); }); it.only('1 plus 1 should be equal to 2'..function() { expect(add(1.1)).to.be.equal(2); }); it.skip('1 plus 1 should be equal to 2'..function() { expect(add(1.1)).to.be.equal(2); }); }); }); Copy the code