<commit_before>// today, our spec files use qunit without requiring it.  That sort of sucks
// for webpack.  This adds a requirement for qunit to each spec file that's digested,
// and adds "qunit." to module and test calls.  Can be cleaned up later, but helps
// us get off the ground running tests in webpack from day one.

module.exports = function(source){
  var newSource = source;

  // add a qunit dependency to the dependency list
  newSource = newSource.replace(/define\(?\s*\[[^\]]/, function(match){
    return match.replace(/\[/, function(innerMatch){
      return innerMatch + "'qunit',";
    });
  });

  // don't want the comma if the list is empty
  newSource = newSource.replace(/define\(?\s*\[\s*\]/, function(match){
    return match.replace(/\[/, function(innerMatch){
      return innerMatch + "'qunit'";
    });
  });

  // add a qunit reference in the AMD callback to capture the qunit dependency
  newSource = newSource.replace(/define[\s\S]*\],\s*\(.*[a-zA-Z].*\)\s*=>/, function(match){
    return match.replace(/\],\s*\(/, function(innerMatch){
      return innerMatch + "qunit,";<commit_msg>Loosen up regex for detecting amd callback<commit_after>// today, our spec files use qunit without requiring it.  That sort of sucks
// for webpack.  This adds a requirement for qunit to each spec file that's digested,
// and adds "qunit." to module and test calls.  Can be cleaned up later, but helps
// us get off the ground running tests in webpack from day one.

module.exports = function(source){
  var newSource = source;

  // add a qunit dependency to the dependency list
  newSource = newSource.replace(/define\(?\s*\[[^\]]/, function(match){
    return match.replace(/\[/, function(innerMatch){
      return innerMatch + "'qunit',";
    });
  });

  // don't want the comma if the list is empty
  newSource = newSource.replace(/define\(?\s*\[\s*\]/, function(match){
    return match.replace(/\[/, function(innerMatch){
      return innerMatch + "'qunit'";
    });
  });

  // add a qunit reference in the AMD callback to capture the qunit dependency
  newSource = newSource.replace(/define[\s\S]*\],\s*\(.*\)\s*=>/, function(match){
    return match.replace(/\],\s*\(/, function(innerMatch){
      return innerMatch + "qunit,";
{'fraction_non_alphanumeric': 0.15418697385910501, 'fraction_numerical': 0.0, 'mean_word_length': 3.3091603053435112, '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': '3388799', 'n_tokens_mistral': 684, 'n_tokens_neox': 660, 'n_words': 239}