<commit_before>// TODO: Update description to 'Create/copy folder to temporary working directory'

function FixtureDir(dir) {
  this.dir = dir;
}
FixtureDir.prototype = {
  enter: function (folderName, options) {
    options = options || {};
    var dir = path.join(this.dir, folderName);
    // TODO: rm folder if it exists
    // If there is a copyFrom, use `wrench.copy`
    // Otherwise, wrench.mkdirp
  },
  exit: function (folderName) {
    // TODO: rm folder
  }
};

// TODO: Make complementary mocha wrapper which receives `fixture-dir` and does enter/exit automagically

module.exports = FixtureDir;
<commit_msg>Sorted out how to deal with graceful previous directory exits<commit_after>// TODO: Update description to 'Create/copy folder to temporary working directory'

function FixtureDir(dir) {
  this.dir = dir;
}
FixtureDir.prototype = {
  enter: function (folderName, options) {
    // If we are already in a directory, complain
    if (this.previousDirectory) {
      throw new Error('`FixtureDir#enter` cannot enter multiple directories at the same time. Please run `FixtureDir#exit` first');
    }

    // Fallback options
    options = options || {};
    var dir = path.join(this.dir, folderName);

    // TODO: Save `previousDirectory`

    // TODO: rm folder if it exists
    // If there is a copyFrom, use `wrench.copy`
    // Otherwise, wrench.mkdirp

    // Move to the new directory
  },
  exit: function () {
    // TODO: rm folder
    // TODO: Reset previous directory
  }
};

// TODO: Make complementary mocha wrapper which receives `fixture-dir` and does enter/exit automagically

module.exports = FixtureDir;

{'fraction_non_alphanumeric': 0.10738255033557047, 'fraction_numerical': 0.0, 'mean_word_length': 3.2487046632124352, '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': '2836344', 'n_tokens_mistral': 481, 'n_tokens_neox': 469, 'n_words': 170}