I'd like to do performance testing for the following unit test.

describe("simple test", async() => {
     it("first test", async() => {
        assert.equal(myProgram(), 1);
     })
})

But I'm not sure where to start.

How can I add performance testing tools to my mocha unit tests?

Two options are mocha-performance & benchtest

mocha-performance

Runtime performance analysis off the back of a mocha test suite

  1. Install with

    npm install mocha-performance
    
  2. Add --allow-natives-syntax and --reporter mocha-performance to your existing mocha script runner like this

    node --allow-natives-syntax ./node_modules/mocha/bin/_mocha --reporter mocha-performance ./test/**/*.js
    

benchtest

Integrated performance testing for Mocha based unit testing

  1. Install with

    npm install benchtest --save-dev
    
  2. Add two global Mocha event hooks

    const benchtest = require("benchtest");
    beforeEach(benchtest.test);
    after(benchtest.report);
    
  3. Add a # to the end of each unit test name you wish to benchmark or use the option all:true