<commit_before>/*!
 * kind-error <https://github.com/tunnckoCore/kind-error>
 *
 * Copyright (c) 2015 <NAME> <@tunnckoCore> (http://www.tunnckocore.tk)
 * Released under the MIT license.
 */

/* jshint asi:true */

'use strict'

var test = require('assertit')
var KindError = require('./index')

test('kind-error:', function () {
  test('should throw Error if not invoked with `new`', function (done) {
    function fixture () {
      KindError()
    }

    test.throws(fixture, Error)
    test.throws(fixture, /Call KindError.*/)
    done()
  })
  test('should have proper name and dont have stack by default', function (done) {
    var err = new KindError()

    test.equal(err.name, 'KindError')
    test.equal(err.stack, undefined)
    done()
  })
  test('should have proper stack if `showStack: true`', function (done) {
    var err = new KindError({showStack: true})

    test.ok(err.stack)
    test.equal(err.stack.length > 5, true)
    test.equal(err.name, 'KindError')
    done()
  })
  test('should dont have stack if showStack given but not true', function (done) {
    var err = new KindError({name: 'HideError', showStack: 123})

    test.equal(err.name, 'HideError')<commit_msg>test: composed error is instanceof Error<commit_after>/*!
 * kind-error <https://github.com/tunnckoCore/kind-error>
 *
 * Copyright (c) 2015 <NAME> <@tunnckoCore> (http://www.tunnckocore.tk)
 * Released under the MIT license.
 */

/* jshint asi:true */

'use strict'

var test = require('assertit')
var KindError = require('./index')

test('kind-error:', function () {
  test('should throw Error if not invoked with `new`', function (done) {
    function fixture () {
      KindError()
    }

    test.throws(fixture, Error)
    test.throws(fixture, /Call KindError.*/)
    done()
  })
  test('should composed error object be instanceof Error', function (done) {
    var err = new KindError()

    test.equal(err instanceof Error, true)
    done()
  })
  test('should have proper name and dont have stack by default', function (done) {
    var err = new KindError()

    test.equal(err.name, 'KindError')
    test.equal(err.stack, undefined)
    done()
  })
  test('should have proper stack if `showStack: true`', function (done) {
    var err = new KindError({showStack: true})

    test.ok(err.stack)
    test.equal(err.stack.length > 5, true)
    test.equal(err.name, 'KindError')
    done()
  })
  test('should dont have stack if showStack given but not true', function (done) {
    var err = new KindError({name: 'HideError', showStack: 123})

    test.equal(err.name, 'HideError')
{'fraction_non_alphanumeric': 0.15011636927851046, 'fraction_numerical': 0.0062063615205585725, 'mean_word_length': 3.4696707105719238, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '839040', 'n_tokens_mistral': 857, 'n_tokens_neox': 825, 'n_words': 238}