<commit_before>module.exports = function(grunt) {

var BROWSERS = process.env.TRAVIS ? 'Firefox' : 'Chrome,ChromeCanary,Firefox,Opera,Safari,PhantomJS';

  // Project configuration.
  grunt.initConfig({
    files: {
      server: ['lib/*.js'],
      client: ['static/testacular.src.js'],
      jasmine: ['adapter/jasmine.src.js'],
      mocha: ['adapter/mocha.src.js']
    },

    lint: {
      server: '<config:files.server>',
      client: '<config:files.client>',
      jasmine: '<config:files.jasmine>',
      mocha: '<config:files.mocha>'
    },

    build: {
      client: '<config:files.client>',
      jasmine: '<config:files.jasmine>',
      mocha: '<config:files.mocha>'
    },

    test: {
      unit: 'test/unit',
      client: 'test/client/config.js',
      e2e: 'test/e2e/*/testacular.conf.js'
    },

    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        node: true,
        es5: true
      },
      globals: {}
    }
  });



  // Default task.
  grunt.registerTask('default', 'lint test docs');


  grunt.registerMultiTask('build', 'Concat and wrap given files.', function() {
    var src = grunt.file.expandFiles(this.data).pop();
    var dest = src.replace('src.js', 'js');
    var wrapper = src.replace('src.js', 'wrapper');

    grunt.file.copy(wrapper, dest, {process: function(content) {
      var wrappers = content.split('%CONTENT%\n');
      return wrappers[0] + grunt.file.read(src) + wrappers[1];
    }});

    grunt.log.ok('Created ' + dest);
  });


  grunt.registerMultiTask('test', 'Run tests.', function() {
    var specDone = this.async();

    // E2E tests
    if (this.target === 'e2e') {
      var tests = grunt.file.expand(this.data);
      var cmd = './bin/testacular';
      var args = [null, '--single-run', '--no-auto-watch', '--browsers=' + BROWSERS];

      var next = function(err, result, code) {
        if (code) {
          grunt.fail.fatal('E2E test "' + args[0] + '" failed.', code);
        } else {
          args[0] = tests.shift();
          if (args[0]) {
            grunt.log.writeln('Running ' + cmd + args.join(' '));
            grunt.utils.spawn({cmd: cmd, args: args}, next).stdout.pipe(process.stdout);
          } else {
            specDone();
          }
        }
      };

      return next();
    }


    // other: unit, client
    var exec = function(cmd, args, failMsg) {
      grunt.utils.spawn({cmd: cmd, args: args}, function(err, result, code) {
        if (code) {
          grunt.fail.fatal(failMsg, code);
        } else {
          specDone();
        }
      }).stdout.pipe(process.stdout);
    };

    var TASK = {
      unit: [
        'jasmine-node',
        ['--coffee', this.data],
        'Unit tests failed.'
      ],

      client: [
        'testacular',
        [this.data, '--single-run', '--no-auto-watch', '--browsers=' + BROWSERS],
        'Client unit tests failed.'
      ]
    };

    exec.apply(null, TASK[this.target]);
  });
};
<commit_msg>Grunt task npm-check<commit_after>module.exports = function(grunt) {

var BROWSERS = process.env.TRAVIS ? 'Firefox' : 'Chrome,ChromeCanary,Firefox,Opera,Safari,PhantomJS';

  // Project configuration.
  grunt.initConfig({
    files: {
      server: ['lib/*.js'],
      client: ['static/testacular.src.js'],
      jasmine: ['adapter/jasmine.src.js'],
      mocha: ['adapter/mocha.src.js']
    },

    lint: {
      server: '<config:files.server>',
      client: '<config:files.client>',
      jasmine: '<config:files.jasmine>',
      mocha: '<config:files.mocha>'
    },

    build: {
      client: '<config:files.client>',
      jasmine: '<config:files.jasmine>',
      mocha: '<config:files.mocha>'
    },

    test: {
      unit: 'test/unit',
      client: 'test/client/config.js',
      e2e: 'test/e2e/*/testacular.conf.js'
    },

    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        node: true,
        es5: true
      },
      globals: {}
    }
  });



  // Default task.
  grunt.registerTask('default', 'lint test docs');


  grunt.registerMultiTask('build', 'Concat and wrap given files.', function() {
    var src = grunt.file.expandFiles(this.data).pop();
    var dest = src.replace('src.js', 'js');
    var wrapper = src.replace('src.js', 'wrapper');

    grunt.file.copy(wrapper, dest, {process: function(content) {
      var wrappers = content.split('%CONTENT%\n');
      return wrappers[0] + grunt.file.read(src) + wrappers[1];
    }});

    grunt.log.ok('Created ' + dest);
  });


  grunt.registerMultiTask('test', 'Run tests.', function() {
    var specDone = this.async();

    // E2E tests
    if (this.target === 'e2e') {
      var tests = grunt.file.expand(this.data);
      var cmd = './bin/testacular';
      var args = [null, '--single-run', '--no-auto-watch', '--browsers=' + BROWSERS];

      var next = function(err, result, code) {
        if (code) {
          grunt.fail.fatal('E2E test "' + args[0] + '" failed.', code);
        } else {
          args[0] = tests.shift();
          if (args[0]) {
            grunt.log.writeln('Running ' + cmd + args.join(' '));
            grunt.utils.spawn({cmd: cmd, args: args}, next).stdout.pipe(process.stdout);
          } else {
            specDone();
          }
        }
      };

      return next();
    }


    // other: unit, client
    var exec = function(cmd, args, failMsg) {
      grunt.utils.spawn({cmd: cmd, args: args}, function(err, result, code) {
        if (code) {
          grunt.fail.fatal(failMsg, code);
        } else {
          specDone();
        }
      }).stdout.pipe(process.stdout);
    };

    var TASK = {
      unit: [
        'jasmine-node',
        ['--coffee', this.data],
        'Unit tests failed.'
      ],

      client: [
        'testacular',
        [this.data, '--single-run', '--no-auto-watch', '--browsers=' + BROWSERS],
        'Client unit tests failed.'
      ]
    };

    exec.apply(null, TASK[this.target]);
  });


  grunt.registerTask('npm-check', 'Show list of files that would be published to npm', function() {
    var exec = require('child_process').exec;
    var done = this.async();

    exec('npm pack', function(err, pkgFile) {
      exec('tar -tf ' + pkgFile, function(err, pkgContent) {
        console.log(pkgContent);
        exec('rm ' + pkgFile, done);
      });
    });
  });
};
{'fraction_non_alphanumeric': 0.17790121603362857, 'fraction_numerical': 0.0033028073862783366, 'mean_word_length': 2.077136258660508, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4238209', 'n_tokens_mistral': 2308, 'n_tokens_neox': 2220, 'n_words': 441}