<commit_before>import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import requireInject from 'require-inject'
import sinon from 'sinon'
import sinonChai from 'sinon-chai'
import test from 'ava'

chai.use(chaiAsPromised)
chai.use(sinonChai)

const expect = chai.expect

test.beforeEach(t => {
  const exists = sinon.stub()
  const stubs = {
    fs: {
      exists,
      mkdir: sinon.stub(),
      readFile: sinon.stub()
    }
  }
  const util = requireInject('../../src/util', stubs)
  t.context = {exists, util}
})

test('rejects if fs.exists returns false', t => {
  const {exists, util} = t.context
  exists.yields(false)
  return expect(util.exists('path')).to.be.eventually.rejected
})

test('resolves if fs.exists returns true', t => {
  const {exists, util} = t.context
  exists.yields(true)
  return expect(util.exists('path')).to.be.eventually.fulfilled
})
<commit_msg>Update test/util/exists to use ava assertions<commit_after>import requireInject from 'require-inject'
import sinon from 'sinon'
import test from 'ava'

test.beforeEach(t => {
  const exists = sinon.stub()
  const stubs = {
    fs: {
      exists,
      mkdir: sinon.stub(),
      readFile: sinon.stub()
    }
  }
  const util = requireInject('../../src/util', stubs)
  t.context = {exists, util}
})

test('rejects if fs.exists returns false', t => {
  const {exists, util} = t.context
  exists.yields(false)
  return t.throws(util.exists('path'))
})

test('resolves if fs.exists returns true', t => {
  const {exists, util} = t.context
  exists.yields(true)
  return util.exists('path').catch(() => t.fail())
})

{'fraction_non_alphanumeric': 0.15298507462686567, 'fraction_numerical': 0.0, 'mean_word_length': 3.690962099125364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '1833684', 'n_tokens_mistral': 564, 'n_tokens_neox': 568, 'n_words': 137}