import './clearDep'; import * as fs from 'fs'; import * as path from 'path'; const arr: { desc: string; module: any }[] = []; fs.readdirSync(path.resolve(__dirname, './description')).forEach(desc => { arr.push({ desc, module: require(`./description/${desc}`) }); }); afterEach(() => { // restore replaced property jest.restoreAllMocks(); }); arr.forEach(item => { describe(item.desc, item.module.default); });