All files / jest index.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 1/1
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 302x 2x   2x 2x   2x   3x   3x       3x   3x                          
import path from 'path';
import Generator from 'yeoman-generator';
 
import { Filenames } from '../lib/enums/filenames';
import rootPkg from '../lib/helpers/package';
 
module.exports = class extends Generator {
  writing() {
    this.fs.append(this.destinationPath(Filenames.README), this.fs.read(this.templatePath(Filenames.README)));
 
    this.fs.copy(
      this.templatePath(Filenames.JEST_TEST),
      this.destinationPath(path.join(Filenames.SRC_FOLDER, 'lib', Filenames.JEST_TEST)),
    );
    this.fs.copy(this.templatePath(Filenames.JEST_CONFIG), this.destinationPath(Filenames.JEST_CONFIG));
 
    this.fs.extendJSON(this.destinationPath(Filenames.PACKAGE_JSON), {
      scripts: {
        test: 'jest --runInBand',
        'test:cov': 'jest --coverage --runInBand',
      },
      devDependencies: {
        '@types/jest': rootPkg.devDependencies['@types/jest'],
        jest: rootPkg.devDependencies.jest,
        'ts-jest': rootPkg.devDependencies['ts-jest'],
      },
    });
  }
};