All files / src/helpers ensure-dir.ts

71.43% Statements 15/21
100% Branches 9/9
87.5% Functions 7/8
81.25% Lines 13/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  2x 1x 1x   2x 1x     2x 2x 2x 2x   1x
import * as chalk from 'chalk';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import {promisify} from 'util';

export async function ensureDir(dirname: string): Promise<void | never> {
  try {
    await promisify(mkdirp)(dirname);
  } catch (err) {
    // tslint:disable-next-line no-console
    console.error(chalk.red(err.essage));
    process.exit(1);
  }
}