<commit_before>// mocha/suites/browser
suite('browser');

var host = document.location.protocol + '//' + document.location.host;

test('global', function () {
  global.should.be.equal(window);
  global.__filename.should.be.equal(__filename);
  global.__dirname.should.be.equal(__dirname);
});

test('__filename', function () {
  __filename.should.be.equal(host + '/lib/browser/monad.js');
});

test('normalize', function () {
  normalize(host + '/lib/browser/monad.js').should.be.equal(__filename);
  normalize(BASEPATH + '../../lib/browser/monad.js').should.be.equal(__filename);
});
      
test('__dirname', function () {
  __dirname.should.be.equal(host + '/lib/browser');
});

test('BASEPATH is document.location.href', function () {
  var pathname = document.location.pathname;
  BASEPATH.should.be.equal(host + pathname.substring(0, pathname.lastIndexOf('/') + 1));
});

test('require', function () {
  require(__filename).should.be.Function;
});

test('module', function () {
  var name = normalize(__filename);
  delete require._cache[name];
  
  Module._load(__filename, { id: __filename });
  
  require._cache[name].id.should.be.equal(name);
  require._cache[name].filename.should.be.equal(name);
  require._cache[name].exports.should.be.equal(require(name));
  require._cache[name].children.should.be.Array;
  require._cache[name].parent.should.be.Object;
  require._cache[name].require.should.be.Function;

});

test('define __filename', function () {
  (define)(__filename).should.be.Function;
  (define)(__filename).id.should.be.equal(__filename);
});

test('define with builtin pathnames', function () {
  (define)(__filename)('assert').should.be.Function;

});

test('define callback', function () {
  (define)(__filename)
  ('assert')
  (function () {
    assert(module.id == __filename /*global.__filename*/);
  }).should.be.Object;
});

test('camelize', function () {
  (define)(__filename)
  ('camelize')
  (function () {
    camelize('kenneth/rex-read.js').should.be.equal('rexRead');
  });
});

test('make', function () {
  (define)(__filename)
  ('make')
  (function () {
    make.should.be.Function;
  });
});

test('Module, using alias', function () {
  (define)(__filename)
  ('Module := module')
  (function () {
    Module.should.be.Function;
  });
});

test('normalize', function () {
  (define)(__filename)
  ('normalize')
  (function () {
    normalize.should.be.Function;
  });
});


<commit_msg>browser mainly works ~ script loading next<commit_after>// mocha/suites/browser
suite('browser');

var host = document.location.protocol + '//' + document.location.host;

test('global', function () {
  global.should.be.equal(window);
  global.__filename.should.be.equal(__filename);
  global.__dirname.should.be.equal(__dirname);
});

test('__filename', function () {
  __filename.should.be.equal(host + '/lib/browser/monad.js');
});

test('normalize', function () {
  normalize(host + '/lib/browser/monad.js').should.be.equal(__filename);
  normalize(BASEPATH + '../../lib/browser/monad.js').should.be.equal(__filename);
});
      
test('__dirname', function () {
  __dirname.should.be.equal(host + '/lib/browser');
});

test('BASEPATH is document.location.href', function () {
  var pathname = document.location.pathname;
  BASEPATH.should.be.equal(host + pathname.substring(0, pathname.lastIndexOf('/') + 1));
});

test('require', function () {
  require(__filename).should.be.Function;
});

test('module', function () {
  var name = normalize(__filename);
  delete require._cache[name];
  
  Module._load(__filename, { id: __filename });
  
  require._cache[name].id.should.be.equal(name);
  require._cache[name].filename.should.be.equal(name);
  require._cache[name].exports.should.be.equal(require(name));
  require._cache[name].children.should.be.Array;
  require._cache[name].parent.should.be.Object;
  require._cache[name].require.should.be.Function;

});

test('define __filename', function () {
  (define)(__filename).should.be.Function;
  (define)(__filename).id.should.be.equal(__filename);
});

test('define with builtin pathnames', function () {
  (define)(__filename)('assert').should.be.Function;
});

test('define callback', function () {
  (define)(__filename)
  ('assert')
  (function () {
    assert(module.id == __filename /*global.__filename*/);
  }).should.be.Object;
});

test('camelize', function () {
  (define)(__filename)
  ('camelize')
  (function () {
    camelize('kenneth/rex-read.js').should.be.equal('rexRead');
  });
});

test('make', function () {
  (define)(__filename)
  ('make')
  (function () {
    make.should.be.Function;
  });
});

test('Module, using alias', function () {
  (define)(__filename)
  ('Module := module')
  (function () {
    Module.should.be.Function;
  });
});

test('normalize', function () {
  (define)(__filename)
  ('normalize')
  (function () {
    normalize.should.be.Function;
  });
});

test('cycle __filename', function () {
  (function () {
    
    (define)(__filename)
    (__filename)
    (function () {
      
    })
  
  }).should.throw();
});

test('cycle self', function () {
  (function () {
    
    (define)('self')
    ('self')
    (function () {
      
    })
  
  }).should.throw();
});

test('cycle deep', function () {
  (function () {

    (define)('a')
    ('b')
    (function () {
      
    });
    
    (define)('b')
    ('c')
    (function () {
      
    });
    
    (define)('c')
    ('a')
    (function () {
      
    });
    
  }).should.throw('cycle: a > b > c > a');
});

test('works inline', function() {
  var exported = (define)('works')
  (function () {
    module.exports = function (arg) {
      return 'works: ' + arg;
    };
  });
  var arg = 'yes';
  exported(arg).should.be.equal('works: ' + arg);
});

{'fraction_non_alphanumeric': 0.20745514718690122, 'fraction_numerical': 0.0006967427277477791, 'mean_word_length': 3.8661016949152542, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3839854', 'n_tokens_mistral': 1911, 'n_tokens_neox': 1899, 'n_words': 265}