Add metadata to mocha test titles.
Build some test types and make them globally available
const mochaTestType = require('mocha-metatitles');
global.slowTest = mochaTestType('slow');
global.fastTest = mochaTestType('fast');
Use test types like the describe
function from mocha:
fastTest('Fast test title:', () => {
it('should work correctly and be fast', () => {
// empty
});
}
- Test titles with test type and file path
- Easy grep through test types
- Setup conditional test execution using
options.argv
parameter. See more options
const mochaTestType = require('mocha-metatitles');
const slowTest = mochaTestType('slow', { argv: { slowTests: true} });
slowTest('Slow test:', () => {
it('Runs only on command line parameter slowTests=true', () => {
// empty
});
}