createTempDir = async () => {
  const dirpath = await fsP.mkdtemp(path.join(os.tmpdir(), 'mocha-'));
  return {
    dirpath,
    removeTempDir: async () => {
      if (!process.env.MOCHA_TEST_KEEP_TEMP_DIRS) {
        return fs.rmSync(dirpath, { recursive: true, force: true });
      }
    }
  };
}
Creates a temporary directory
@returns {Promise<CreateTempDirResult>} Temp dir path and cleanup function