function generateHtmlForDirectory(directory, args) {
  const directoryContents = fs.readdirSync(directory);
  const subDirectories = [];

  for (const filename of directoryContents) {
    const fullname = path.join(directory, filename);
    const stats = fs.statSync(fullname);
    if (stats.isDirectory() && args.recursive) {
      subDirectories.push(fullname);
    } else if (stats.isFile()) {
      maybeGenerateHtmlForFile(fullname, args);
    }
  }

  for (const subDirectory of subDirectories) {
    generateHtmlForDirectory(subDirectory, args);
  }
}
Generates one _test.html file for each _test.js file in the given directory.

@param {string} directory Directory to generate files for.
@param {!Args} args