<commit_before>/* eslint import/no-extraneous-dependencies:0 */
/* eslint no-param-reassign:0 */
import test from 'ava';

import Bundler from '../src/Bundler';

test.beforeEach((t) => {
  t.context.bundlerInstance = new Bundler();
});

test.cb('returns bundled javascript', (t) => {
  t.pass(1);

  t.context.bundlerInstance.bundle(
    'console.log(\'foo\');'
  ).then((result) => {
    t.regex(result, /console\.log\('foo'\)/);
    t.end();
  });
});

test.cb('returns error if bundle fails', (t) => {
  t.pass(1);

  const bundler = new Bundler({
    folder: '/some/nonexisting/folder/'
  });

  bundler.bundle(
    'console.log(\'foo\');'
  ).catch((err) => {
    t.regex(
      err.message,
      /ENOENT: no such file or directory/
    );
    t.end();
  });
});<commit_msg>Use await<commit_after>/* eslint import/no-extraneous-dependencies:0 */
/* eslint no-param-reassign:0 */
import test from 'ava';

import Bundler from '../src/Bundler';

test.beforeEach((t) => {
  t.context.bundlerInstance = new Bundler();
});

test('returns bundled javascript', async (t) => {
  t.plan(1);

  const res = await t.context.bundlerInstance.bundle(
    'console.log(\'foo\');'
  );

  t.regex(res, /console\.log\('foo'\)/);
});

test.cb('returns error if bundle fails', (t) => {
  t.plan(1);

  const bundler = new Bundler({
    folder: '/some/nonexisting/folder/'
  });

  bundler.bundle(
    'console.log(\'foo\');'
  ).catch((err) => {
    t.regex(
      err.message,
      /ENOENT: no such file or directory/
    );
    t.end();
  });
});
{'fraction_non_alphanumeric': 0.21447196870925683, 'fraction_numerical': 0.005215123859191656, 'mean_word_length': 2.987012987012987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '7528884', 'n_tokens_mistral': 575, 'n_tokens_neox': 559, 'n_words': 109}