<commit_before>var udeps = require('../index');
var expect = require('expect.js');

describe('get the right deps', function (){
  var s = 'var RE=/[\\\\]/,str="\\\\"||"[\\\\]"||"/*";require("a");require(\'b"\');require("c\\"");';
  var res = udeps(s);

  it('path', function (){
    expect(res.map(function (o){
      return o.path;
    })).to.eql(['a', 'b"', 'c"']);
  });

  it('use replace', function (){
    var s = 'require("a");require("b");var num=0||.7e+7||7.7e+7||0xff;/*';
    var res = udeps(s, function (path){
      return 'woot/' + path;
    });

    expect(res).to.eql('require("woot/a");require("woot/b");var num=0||.7e+7||7.7e+7||0xff;/*');
  });

  it('reg & comment', function (){
    var s = '(1)/*\n*/ / require("a");return/*\nreturn*/;return/\\/;';
    var res = udeps(s, true).map(function (o){
      return o.path;
    });

    expect(res).to.eql(["a"]);
  });

  it('include async', function (){<commit_msg>optimize code and bug fixed<commit_after>var udeps = require('../index');
var expect = require('expect.js');

describe('get the right deps', function (){
  var s = 'var RE=/[\\\\]/,str="\\\\"||"[\\\\]"||"/*";require("a");require(\'b"\');require("c\\"");require(["d"]);';
  var res = udeps(s);

  it('path', function (){
    expect(res.map(function (o){
      return o.path;
    })).to.eql(['a', 'b"', 'c"']);
  });

  it('use replace', function (){
    var s = 'require("a");require("b");var num=0||.7e+7||7.7e+7||0xff;/*';
    var res = udeps(s, function (path){
      return 'woot/' + path;
    });

    expect(res).to.eql('require("woot/a");require("woot/b");var num=0||.7e+7||7.7e+7||0xff;/*');
  });

  it('reg & comment', function (){
    var s = '(1)/*\n*/ / require("a");return/*\nreturn*/;return/\\/;';
    var res = udeps(s, true).map(function (o){
      return o.path;
    });

    expect(res).to.eql(["a"]);
  });

  it('include async', function (){
{'fraction_non_alphanumeric': 0.3048071843634443, 'fraction_numerical': 0.01584786053882726, 'mean_word_length': 3.2947845804988662, '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': '1490044', 'n_tokens_mistral': 776, 'n_tokens_neox': 743, 'n_words': 128}