<commit_before>import * as config from './config'
import os from 'os'
import fs from 'fs'
import path from 'path'
const pkg = require('../../../package.json')

test('unit:core:helpers:config:get', async () => {
  const conf1 = await config.get()
  expect(conf1).toEqual({})

  pkg.name = 'fakkkkkker'
  pkg.bin = './bin/foo.js'
  const conf2 = await config.get()
  expect(conf2).toEqual({})
})

test('unit:core:helpers:config:get:name', async () => {
  const conf = await config.get('fakkkkkker')
  expect(conf).toEqual({})
})

test('unit:core:helpers:config:get:from', async () => {
  const conf = await config.get('test', path.join(__dirname, '../../../test/fixtures'))
  expect(conf).toEqual({ foo: 'bar' })
})

test('unit:core:helpers:config:get:options', async () => {
  const conf = await config.get('fakkkkkker', process.cwd(), { cache: false })
  expect(conf).toEqual({})
})

test('unit:core:helpers:config:ini', async () => {
  const conf = await config.ini(path.join(__dirname, '../../../test/fixtures/test.ini'))
  expect(conf).toEqual({ foo: 'bar' })
})

test('unit:core:helpers:config:npm', async () => {
  const npmrc = path.join(os.homedir(), '.npmrc')
  if (!fs.existsSync(npmrc)) {
    await fs.promises.writeFile(npmrc, '')
  }
  const conf = await config.npm()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:yarn', async () => {
  const yarnrc = path.join(os.homedir(), '.yarnrc')
  if (!fs.existsSync(yarnrc)) {
    await fs.promises.writeFile(yarnrc, '')
  }
  const conf = await config.yarn()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:git', async () => {
  const gitconfig = path.join(os.homedir(), '.gitconfig')
  if (!fs.existsSync(gitconfig)) {
    await fs.promises.writeFile(gitconfig, '')
  }
  const conf = await config.git()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:username', async () => {
  const username = await config.username()
  expect(username).toBeTruthy()
})

test('unit:core:helpers:config:fullname', async () => {
  const fullname = await config.fullname()
  expect(fullname).toBeTruthy()
})<commit_msg>fix: config tests<commit_after>import * as config from './config'
import os from 'os'
import fs from 'fs'
import path from 'path'
const pkg = require('../../../package.json')

test('unit:core:helpers:config:get', async () => {
  const conf1 = await config.get()
  expect(conf1).toEqual({})

  pkg.name = 'fakkkkkker'
  pkg.bin = './bin/foo.js'
  const conf2 = await config.get()
  expect(conf2).toEqual({})
})

test('unit:core:helpers:config:get:name', async () => {
  const conf = await config.get('fakkkkkker')
  expect(conf).toEqual({})
})

test('unit:core:helpers:config:get:from', async () => {
  const conf = await config.get('test', path.join(__dirname, '../../../test/fixtures'))
  expect(conf).toEqual({ foo: 'bar' })
})

test('unit:core:helpers:config:get:options', async () => {
  const conf = await config.get('fakkkkkker', process.cwd(), { cache: false })
  expect(conf).toEqual({})
})

test('unit:core:helpers:config:ini', async () => {
  const conf = await config.ini(path.join(__dirname, '../../../test/fixtures/test.ini'))
  expect(conf).toEqual({ foo: 'bar' })
})

test('unit:core:helpers:config:npm', async () => {
  const npmrc = path.join(os.homedir(), '.npmrc')
  if (!fs.existsSync(npmrc)) {
    await fs.promises.writeFile(npmrc, 'foo = bar')
  }
  const conf = await config.npm()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:yarn', async () => {
  const yarnrc = path.join(os.homedir(), '.yarnrc')
  if (!fs.existsSync(yarnrc)) {
    await fs.promises.writeFile(yarnrc, 'foo = bar')
  }
  const conf = await config.yarn()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:git', async () => {
  const gitconfig = path.join(os.homedir(), '.gitconfig')
  if (!fs.existsSync(gitconfig)) {
    await fs.promises.writeFile(gitconfig, 'foo = bar')
  }
  const conf = await config.git()
  expect(conf).toBeTruthy()
})

test('unit:core:helpers:config:username', async () => {
  const username = await config.username()
  expect(username).toBeTruthy()
})

test('unit:core:helpers:config:fullname', async () => {
  const fullname = await config.fullname()
  expect(fullname).toBeTruthy()
})
{'fraction_non_alphanumeric': 0.20759613116301015, 'fraction_numerical': 0.001887237556027365, 'mean_word_length': 4.586297760210804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '7126836', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1517, 'n_words': 274}