<commit_before>import {sandbox as sinonSandbox} from 'sinon';
import config from '../../lib/core/config';
import loggers from '../../lib/core/loggers';

let sandbox, stubs;

export default function createCoreStubs() {
  if (sandbox) {
    sandbox.reset();
    return {sandbox, stubs};
  }

  sandbox = sinonSandbox.create();
  stubs = {
    config: sandbox.stub(config),
    loggers: sandbox.stub(loggers)
  };

  function n() {}

  stubs.loggers.get.returns(
    sandbox.stub({error: n, warn: n, info: n}));

  return {sandbox, stubs};
}<commit_msg>Fix stubs not getting cleaned up between tests<commit_after>import {sandbox as sinonSandbox} from 'sinon';
import config from '../../lib/core/config';
import loggers from '../../lib/core/loggers';

let sandbox;

export default function createCoreStubs() {
  if (sandbox) {
    sandbox.restore();
  } else {
    sandbox = sinonSandbox.create();
  }

  const stubs = {
    config: sandbox.stub(config),
    loggers: sandbox.stub(loggers)
  };

  function n() {}

  stubs.loggers.get.returns(
    sandbox.stub({error: n, warn: n, info: n}));

  return {sandbox, stubs};
}
{'fraction_non_alphanumeric': 0.15831842576028624, 'fraction_numerical': 0.0, 'mean_word_length': 3.5120967741935485, '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': '2624134', 'n_tokens_mistral': 401, 'n_tokens_neox': 390, 'n_words': 97}