<commit_before>var path = require('path');
var assert = require('assert');
var expect = require('expect');
var Promise = require('bluebird');
var MimosaProject = require('./MimosaProject');

describe('node-jscs', function(){
  var project;

  beforeEach(function () {
    project = new MimosaProject();
    project.mimosaConfig.modules.push('jscs');
    return project.exec('npm', 'install', path.normalize(process.cwd()));
  });

  // Helper function that, given a MimosaProject build result, returns
  // a resolved promise with an array of JSCS violations. Intended for<commit_msg>Retry npm install in test project<commit_after>var path = require('path');
var assert = require('assert');
var expect = require('expect');
var Promise = require('bluebird');
var MimosaProject = require('./MimosaProject');

describe('node-jscs', function(){
  var project;

  beforeEach(function () {
    function setup() {
      project = new MimosaProject();
      project.mimosaConfig.modules.push('jscs');
      return project.exec('npm', 'install', path.normalize(process.cwd()));
    }

    // Setup sometimes fails because npm install fails. This appears
    // to be random and possibly a bug in npm. The code below is a
    // workaround that retries the installation twice before giving
    // up.
    return setup().catch(setup).catch(setup);
  });

  // Helper function that, given a MimosaProject build result, returns
  // a resolved promise with an array of JSCS violations. Intended for
{'fraction_non_alphanumeric': 0.13198653198653199, 'fraction_numerical': 0.0, 'mean_word_length': 4.124137931034483, 'pattern_counts': {'":': 0, '<': 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': '2074536', 'n_tokens_mistral': 425, 'n_tokens_neox': 410, 'n_words': 136}