<commit_before>var assert = require('assert')
var fs = require('fs')
var path = require('path')
var fse = require('../')
var testutil = require('testutil')

var DIR = ''

describe('read', function() {
  beforeEach(function() {
    DIR = testutil.createTestDir('fs-extra')
  })

  afterEach(function(done) {
    fse.remove(DIR, done)
  })

  describe('+ readJSON', function() {
    it('should read a file and parse the json', function(done) {
      var obj1 = {
        firstName: 'JP',
        lastName: 'Richardson'
      }

      var file = path.join(DIR, 'file.json')
      fs.writeFileSync(file, JSON.stringify(obj1))     
      fse.readJSON(file, function(err, obj2) {
        assert.ifError(err)
        assert.strictEqual(obj1.firstName, obj2.firstName)
        assert.strictEqual(obj1.lastName, obj2.lastName)
        
        done()
      })
    })

    it('should error if it cant parse the json', function(done) {
      var file = path.join(DIR, 'file2.json')
      fs.writeFileSync(file, '%asdfasdff444')
      fse.readJSON(file, function(err, obj) {
        assert(err)
        assert(!obj)
        done()
      })
    })
  })
})

<commit_msg>test/read.test: changed DIR to TEST_DIR<commit_after>var assert = require('assert')
var fs = require('fs')
var path = require('path')
var fse = require('../')
var testutil = require('testutil')

var TEST_DIR = ''

describe('read', function() {
  beforeEach(function() {
    TEST_DIR = testutil.createTestDir('fs-extra')
  })

  afterEach(function(done) {
    fse.remove(TEST_DIR, done)
  })

  describe('+ readJSON', function() {
    it('should read a file and parse the json', function(done) {
      var obj1 = {
        firstName: 'JP',
        lastName: 'Richardson'
      }

      var file = path.join(TEST_DIR, 'file.json')
      fs.writeFileSync(file, JSON.stringify(obj1))     
      fse.readJSON(file, function(err, obj2) {
        assert.ifError(err)
        assert.strictEqual(obj1.firstName, obj2.firstName)
        assert.strictEqual(obj1.lastName, obj2.lastName)
        
        done()
      })
    })

    it('should error if it cant parse the json', function(done) {
      var file = path.join(TEST_DIR, 'file2.json')
      fs.writeFileSync(file, '%asdfasdff444')
      fse.readJSON(file, function(err, obj) {
        assert(err)
        assert(!obj)
        done()
      })
    })
  })
})


{'fraction_non_alphanumeric': 0.15023275497249258, 'fraction_numerical': 0.009310198899703767, 'mean_word_length': 2.6651162790697676, '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': '6391897', 'n_tokens_mistral': 805, 'n_tokens_neox': 784, 'n_words': 162}