<commit_before>const test = require('ava')
const sinon = require('sinon')

// couldn't figure out a way to reset the spy on console.log
// for each run... switched to .serial and incrementing.  sorry.  :(
let i = 0

// hijack the console
console.log = x => x

// then spy on it
const spyLog = sinon.spy(console, 'log')

// finally require the print
const print = require('./print')

test.before(() => {
})

test.after.always(() => {
  spyLog.reset()
})

test.serial('info', t => {
  print.info('hi')
  t.is(spyLog.args[i++][0], print.colors.reset('hi'))
})

test.serial('warning', t => {
  print.warning('hi')
  t.is(spyLog.args[i++][0], print.colors.yellow('hi'))
})

test.serial('success', t => {
  print.success('hi')
  t.is(spyLog.args[i++][0], print.colors.green('hi'))
})

test.serial('error', t => {
  print.error('hi')
  t.is(spyLog.args[i++][0], print.colors.error('hi'))
})

test.serial('debug with default', t => {
  const topLine = `vvv -----[ DEBUG ]----- vvv`
  const botLine = `^^^ -----[ DEBUG ]----- ^^^`
  print.debug('hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(topLine))
  t.is(spyLog.args[i++][0], 'hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(botLine))
})

test.serial('debug with title', t => {
  const title = 'there'
  const topLine = `vvv -----[ ${title} ]----- vvv`
  const botLine = `^^^ -----[ ${title} ]----- ^^^`
  print.debug('hi', title)
  t.is(spyLog.args[i++][0], print.colors.rainbow(topLine))
  t.is(spyLog.args[i++][0], 'hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(botLine))
})

test.serial('fancy', t => {
  print.fancy('hi')
  t.is(spyLog.args[i++][0], 'hi')
})

test.serial('divider', t => {
  const line = '---------------------------------------------------------------'
  print.divider()
  t.is(spyLog.args[i++][0], print.colors.line(line))
})

test.serial('newline', t => {
  print.newline()
  t.is(spyLog.args[i++][0], '')
})

test.serial('table', t => {
  const data = [
    ['liam', '5'],
    ['matthew', '2']
  ]
  print.table(data)
  t.is(spyLog.args[i++][0], '  liam      5  \n  matthew   2  ')
})

test.only('spin', t => {
  t.is(typeof print.spin, 'function')
  const spinner = print.spin()
  t.is(typeof spinner.stop, 'function')
})

test.serial('colors', t => {
  t.is(typeof print.colors.highlight, 'function')
  t.is(typeof print.colors.info, 'function')
  t.is(typeof print.colors.warning, 'function')
  t.is(typeof print.colors.success, 'function')
  t.is(typeof print.colors.error, 'function')
  t.is(typeof print.colors.line, 'function')
  t.is(typeof print.colors.muted, 'function')
})<commit_msg>Removes the .only from the print tests.<commit_after>const test = require('ava')
const sinon = require('sinon')

// couldn't figure out a way to reset the spy on console.log
// for each run... switched to .serial and incrementing.  sorry.  :(
let i = 0

// hijack the console
console.log = x => x

// then spy on it
const spyLog = sinon.spy(console, 'log')

// finally require the print
const print = require('./print')

test.before(() => {
})

test.after.always(() => {
  spyLog.reset()
})

test.serial('info', t => {
  print.info('hi')
  t.is(spyLog.args[i++][0], print.colors.reset('hi'))
})

test.serial('warning', t => {
  print.warning('hi')
  t.is(spyLog.args[i++][0], print.colors.yellow('hi'))
})

test.serial('success', t => {
  print.success('hi')
  t.is(spyLog.args[i++][0], print.colors.green('hi'))
})

test.serial('error', t => {
  print.error('hi')
  t.is(spyLog.args[i++][0], print.colors.error('hi'))
})

test.serial('debug with default', t => {
  const topLine = `vvv -----[ DEBUG ]----- vvv`
  const botLine = `^^^ -----[ DEBUG ]----- ^^^`
  print.debug('hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(topLine))
  t.is(spyLog.args[i++][0], 'hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(botLine))
})

test.serial('debug with title', t => {
  const title = 'there'
  const topLine = `vvv -----[ ${title} ]----- vvv`
  const botLine = `^^^ -----[ ${title} ]----- ^^^`
  print.debug('hi', title)
  t.is(spyLog.args[i++][0], print.colors.rainbow(topLine))
  t.is(spyLog.args[i++][0], 'hi')
  t.is(spyLog.args[i++][0], print.colors.rainbow(botLine))
})

test.serial('fancy', t => {
  print.fancy('hi')
  t.is(spyLog.args[i++][0], 'hi')
})

test.serial('divider', t => {
  const line = '---------------------------------------------------------------'
  print.divider()
  t.is(spyLog.args[i++][0], print.colors.line(line))
})

test.serial('newline', t => {
  print.newline()
  t.is(spyLog.args[i++][0], '')
})

test.serial('table', t => {
  const data = [
    ['liam', '5'],
    ['matthew', '2']
  ]
  print.table(data)
  t.is(spyLog.args[i++][0], '  liam      5  \n  matthew   2  ')
})

test.serial('spin', t => {
  t.is(typeof print.spin, 'function')
  const spinner = print.spin()
  t.is(typeof spinner.stop, 'function')
})

test.serial('colors', t => {
  t.is(typeof print.colors.highlight, 'function')
  t.is(typeof print.colors.info, 'function')
  t.is(typeof print.colors.warning, 'function')
  t.is(typeof print.colors.success, 'function')
  t.is(typeof print.colors.error, 'function')
  t.is(typeof print.colors.line, 'function')
  t.is(typeof print.colors.muted, 'function')
})
{'fraction_non_alphanumeric': 0.2644119907763259, 'fraction_numerical': 0.007302075326671791, 'mean_word_length': 3.2489795918367346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '2191821', 'n_tokens_mistral': 2033, 'n_tokens_neox': 2020, 'n_words': 366}