By default, when importing mocha
in TypeScript, it brings in describe
and it
(and some others) into the global namespace.
Is there a way to bring in specific imports like import {describe, it} from 'mocha'
?
Install mocha and its types:
npm install mocha --save-dev
npm install @types/mocha --save-dev
Then, simply import mocha in your test files:
import 'mocha';
describe('my test', () => {
it('does something', () => {
// your test
});
});