<commit_before>/*global describe, beforeEach, it*/

var path = require('path');
var assert = require('assert');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-generator').assert;
var _ = require('underscore');

describe('Webapp generator', function () {
  // not testing the actual run of generators yet
  it('the generator can be required without throwing', function () {
    this.app = require('../app');
  });

  describe('run test', function () {

    var expectedContent = [
      ['bower.json', /"name": "tmp"/],
      ['package.json', /"name": "tmp"/]
    ];
    var expected = [
      '.editorconfig',
      '.gitignore',
      '.gitattributes',
      'package.json',
      'bower.json',
      'Gruntfile.js',
      'app/favicon.ico',
      'app/robots.txt',
      'app/index.ejs'
    ];

    var options = {
      'skip-install-message': true,
      'skip-install': true,
      'skip-welcome-message': true,
      'skip-message': true
    };

    var runGen;

    beforeEach(function () {
      runGen = helpers
        .run(path.join(__dirname, '../app'))
        .inDir(path.join(__dirname, '.tmp'))
        .withGenerators([[helpers.createDummyGenerator(), 'mocha:app']]);
    });

    it('creates expected files', function (done) {
      runGen.withOptions(options).on('end', function () {

        assert.file([].concat(
          expected,
          'app/styles/main.css',
          'app/scripts/main.js'
        ));
        assert.noFile([
          'app/styles/main.scss',
          'app/scripts/main.coffee'
        ]);

        assert.fileContent(expectedContent);
        assert.noFileContent([
          ['initConfig.js', /coffee/],
          ['initConfig.js', /modernizr/],
          ['app/index.html', /modernizr/],
          ['bower.json', /modernizr/],
          ['package.json', /modernizr/],
          ['initConfig.js', /bootstrap/],
          ['app/index.html', /bootstrap/],
          ['bower.json', /bootstrap/],
          ['initConfig.js', /sass/],
          ['app/index.html', /Sass/],
          ['.gitignore', /\.sass-cache/],
          ['package.json', /grunt-contrib-sass/],
          ['package.json', /grunt-sass/],
          ['initConfig.js', /bootstrap-sass-official/],
          ['app/index.ejs', /Sass is a mature/],
          ['bower.json', /bootstrap-sass-official/]
        ]);
        done();
      });
    });

    it('creates expected CoffeeScript files', function (done) {
      runGen.withOptions(
        _.extend(options, {coffee: true})
      ).on('end', function () {

        assert.file([].concat(
          expected,
          'app/scripts/main.coffee'
        ));
        assert.noFile('app/scripts/main.js');

        assert.fileContent([].concat(
          expectedContent,
          [['initConfig.js', /coffee/]]
        ));

        done();
      });
    });

    it('creates expected modernizr components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeModernizr']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /modernizr/],
          ['app/index.ejs', /modernizr/],
          ['bower.json', /modernizr/],
          ['package.json', /modernizr/],
        ]);

        done();
      });
    });

    it('creates expected bootstrap components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeBootstrap']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /bootstrap/],
          ['app/index.ejs', /bootstrap/],
          ['bower.json', /bootstrap/]
        ]);

        done();
      });
    });

    it('creates expected ruby SASS components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeSass']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /sass/],
          ['app/index.ejs', /Sass/],
          ['.gitignore', /\.sass-cache/],
          ['package.json', /grunt-contrib-sass/]
        ]);

        assert.noFileContent([
          ['package.json', /grunt-sass/],
          ['app/index.html', /Sass is a mature/]
        ]);
<commit_msg>Fix to ejs from html<commit_after>/*global describe, beforeEach, it*/

var path = require('path');
var assert = require('assert');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-generator').assert;
var _ = require('underscore');

describe('Webapp generator', function () {
  // not testing the actual run of generators yet
  it('the generator can be required without throwing', function () {
    this.app = require('../app');
  });

  describe('run test', function () {

    var expectedContent = [
      ['bower.json', /"name": "tmp"/],
      ['package.json', /"name": "tmp"/]
    ];
    var expected = [
      '.editorconfig',
      '.gitignore',
      '.gitattributes',
      'package.json',
      'bower.json',
      'Gruntfile.js',
      'app/favicon.ico',
      'app/robots.txt',
      'app/index.ejs'
    ];

    var options = {
      'skip-install-message': true,
      'skip-install': true,
      'skip-welcome-message': true,
      'skip-message': true
    };

    var runGen;

    beforeEach(function () {
      runGen = helpers
        .run(path.join(__dirname, '../app'))
        .inDir(path.join(__dirname, '.tmp'))
        .withGenerators([[helpers.createDummyGenerator(), 'mocha:app']]);
    });

    it('creates expected files', function (done) {
      runGen.withOptions(options).on('end', function () {

        assert.file([].concat(
          expected,
          'app/styles/main.css',
          'app/scripts/main.js'
        ));
        assert.noFile([
          'app/styles/main.scss',
          'app/scripts/main.coffee'
        ]);

        assert.fileContent(expectedContent);
        assert.noFileContent([
          ['initConfig.js', /coffee/],
          ['initConfig.js', /modernizr/],
          ['app/index.ejs', /modernizr/],
          ['bower.json', /modernizr/],
          ['package.json', /modernizr/],
          ['initConfig.js', /bootstrap/],
          ['app/index.ejs', /bootstrap/],
          ['bower.json', /bootstrap/],
          ['initConfig.js', /sass/],
          ['app/index.ejs', /Sass/],
          ['.gitignore', /\.sass-cache/],
          ['package.json', /grunt-contrib-sass/],
          ['package.json', /grunt-sass/],
          ['initConfig.js', /bootstrap-sass-official/],
          ['app/index.ejs', /Sass is a mature/],
          ['bower.json', /bootstrap-sass-official/]
        ]);
        done();
      });
    });

    it('creates expected CoffeeScript files', function (done) {
      runGen.withOptions(
        _.extend(options, {coffee: true})
      ).on('end', function () {

        assert.file([].concat(
          expected,
          'app/scripts/main.coffee'
        ));
        assert.noFile('app/scripts/main.js');

        assert.fileContent([].concat(
          expectedContent,
          [['initConfig.js', /coffee/]]
        ));

        done();
      });
    });

    it('creates expected modernizr components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeModernizr']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /modernizr/],
          ['app/index.ejs', /modernizr/],
          ['bower.json', /modernizr/],
          ['package.json', /modernizr/],
        ]);

        done();
      });
    });

    it('creates expected bootstrap components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeBootstrap']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /bootstrap/],
          ['app/index.ejs', /bootstrap/],
          ['bower.json', /bootstrap/]
        ]);

        done();
      });
    });

    it('creates expected ruby SASS components', function (done) {
      runGen.withOptions(options).withPrompt({features: ['includeSass']})
      .on('end', function () {

        assert.fileContent([
          ['initConfig.js', /sass/],
          ['app/index.ejs', /Sass/],
          ['.gitignore', /\.sass-cache/],
          ['package.json', /grunt-contrib-sass/]
        ]);

        assert.noFileContent([
          ['package.json', /grunt-sass/],
          ['app/index.ejs', /Sass is a mature/]
        ]);

{'fraction_non_alphanumeric': 0.18774727250929146, 'fraction_numerical': 0.0, 'mean_word_length': 2.034558021098581, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5139703', 'n_tokens_mistral': 2646, 'n_tokens_neox': 2551, 'n_words': 446}