<commit_before>
var assert = chai.assert;

describe('evaluation', function () {
  var box = window.modulebox({
    url: function (acquired, source, request) {
      return 'http://localhost:17000/module' +
        '?acquired=' + JSON.stringify(acquired) +
        '&source=' + JSON.stringify(source) +
        '&request=' + JSON.stringify(request);
    }
  });

  var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

  if (is_chrome) {
    it('source map creates a meaningful stack trace', function (done) {
      box.require.ensure(['/throw.js'], function (err) {
        assert.equal(err, null);

        var produce = box.require('/throw.js');
        setTimeout(function() {
          var error = produce();
          assert.ok((/throw\.js/).test(error.stack), 'throw.js exists in stack trace');

          done(null);<commit_msg>[test] custom source map for filenames<commit_after>
var assert = chai.assert;

describe('evaluation', function () {
  var box = window.modulebox({
    url: function (acquired, source, request) {
      return 'http://localhost:17000/module' +
        '?acquired=' + JSON.stringify(acquired) +
        '&source=' + JSON.stringify(source) +
        '&request=' + JSON.stringify(request);
    }
  });

  var boxCustom = window.modulebox({
    url: function (acquired, source, request) {
      return 'http://localhost:17000/module' +
        '?acquired=' + JSON.stringify(acquired) +
        '&source=' + JSON.stringify(source) +
        '&request=' + JSON.stringify(request);
    },

    source: function (filepath) {
      return '/custom' + filepath;
    }
  });

  var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

  if (is_chrome) {
    it('source map creates a meaningful stack trace', function (done) {
      box.require.ensure(['/throw.js'], function (err) {
        assert.equal(err, null);

        var produce = box.require('/throw.js');
        setTimeout(function() {
          var error = produce();
          assert.ok((/\/modulebox\/throw\.js/).test(error.stack), 'throw.js exists in stack trace');

          done(null);
        }, 0);
      });
    });

    it('source map filename are customizeable', function (done) {
      boxCustom.require.ensure(['/throw.js'], function (err) {
        assert.equal(err, null);

        var produce = boxCustom.require('/throw.js');
        setTimeout(function() {
          var error = produce();
          assert.ok((/\/custom\/throw\.js/).test(error.stack), 'throw.js exists in stack trace');

          done(null);
{'fraction_non_alphanumeric': 0.1665360501567398, 'fraction_numerical': 0.007053291536050157, 'mean_word_length': 2.705370101596517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '487745', 'n_tokens_mistral': 785, 'n_tokens_neox': 749, 'n_words': 165}