<commit_before>var path = require('path')
var test = require('tape')
var spawn = require('tape-spawn')
var tmp = require('os').tmpdir()
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')

var dat = path.resolve(__dirname + '/../../cli.js')

module.exports = {
  onedat: onedat,
  twodats: twodats,
  conflict: conflict,
  randomTmpDir: randomTmpDir
}

function onedat (datPath) {
  rimraf.sync(datPath)
  mkdirp.sync(datPath)

  test('init a dat', function (t) {
    var st = spawn(t, dat + ' init', {cwd: datPath})
    st.stderr.match(/Initialized a new dat/)
    st.stdout.empty()
    st.end()
  })
}

function twodats (dat1, dat2) {
  onedat(dat1)
  onedat(dat2)<commit_msg>clean up before each dat init<commit_after>var path = require('path')
var test = require('tape')
var spawn = require('tape-spawn')
var tmp = require('os').tmpdir()
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')

var dat = path.resolve(__dirname + '/../../cli.js')

module.exports = {
  onedat: onedat,
  twodats: twodats,
  conflict: conflict,
  randomTmpDir: randomTmpDir
}

function onedat (datPath) {
  test('init a dat', function (t) {
    rimraf.sync(datPath)
    mkdirp.sync(datPath)
    var st = spawn(t, dat + ' init', {cwd: datPath})
    st.stderr.match(/Initialized a new dat/)
    st.stdout.empty()
    st.end()
  })
}

function twodats (dat1, dat2) {
  onedat(dat1)
  onedat(dat2)
{'fraction_non_alphanumeric': 0.16344086021505377, 'fraction_numerical': 0.005734767025089606, 'mean_word_length': 3.830449826989619, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4786903', 'n_tokens_mistral': 531, 'n_tokens_neox': 522, 'n_words': 124}