<commit_before>import test from 'ava'
import path from 'path'
import { spy } from 'sinon'
import read from '../lib/read'

test('reads files correctly', async t => {
  const config = {
    source: 'test/sample'
  }
  const args = {
    config,
    logger: {
      debug: spy()
    }
  }
  const res = await read(args)
  const expectedPath = path.join(__dirname, 'sample/test.md')

  t.true(res['test.md'].path === expectedPath)
  t.true(args.logger.debug.callCount === 2)
})

test('throws on nonexistent path', async t => {
  const config = {
    source: 'test/fakepath'
  }
  const args = {
    config,
    logger: {
      debug: spy()
    }
  }

  try {
    await read(args)
  } catch (err) {
    t.truthy(err[0])
    t.is(err[0].code, 'ENOENT')
    t.true(args.logger.debug.callCount === 0)
  }
})<commit_msg>fix test timeout<commit_after>import test from 'ava'
import path from 'path'
import { spy } from 'sinon'
import read from '../lib/read'

test('reads files correctly', async t => {
  const config = {
    source: 'test/sample',
    exclude: []
  }
  const args = {
    config,
    logger: {
      debug: spy()
    }
  }
  const res = await read(args)
  const expectedPath = path.join(__dirname, 'sample/test.md')

  t.true(res['test.md'].path === expectedPath)
  t.true(args.logger.debug.callCount === 2)
})

test('throws on nonexistent path', async t => {
  const config = {
    source: 'test/fakepath'
  }
  const args = {
    config,
    logger: {
      debug: spy()
    }
  }

  try {
    await read(args)
  } catch (err) {
    t.truthy(err[0])
    t.is(err[0].code, 'ENOENT')
    t.is(args.logger.debug.callCount, 0)
  }
})
{'fraction_non_alphanumeric': 0.16371411117898596, 'fraction_numerical': 0.004886988393402566, 'mean_word_length': 2.689189189189189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6841608', 'n_tokens_mistral': 602, 'n_tokens_neox': 591, 'n_words': 141}