How do I add chaijs's assert in mocha's mocha.opts file?

I don't know if this is even possible. I know if we just use should.js library we can do the following in mocha.opts file

--require should

But since chai is a parent module and assert is sub-module of chai, how do I require it in mocha.opts file?

Or am I missing something really basic?

AFAIK chai and mocha are not compatible in this way. It only works with should because should modifies the prototypes of the built-in objects, which some folks find acceptable for this particular use case but in general it is regarded as a bad practice to be avoided.

What you can do instead is write your own little wrapper module that does this:

global.assert = require('chai').assert;

And then in your mocha.opts you can do --require global-chai-assert and your tests will have access to chai's assert function as a global. I personally think this is an antipattern, but if you like it, that's how I'd do it.