<commit_before>"use strict";

const assert = require("assert");
const path = require("path");
const shell = require("shelljs");
const spawn = require("cross-spawn");
const fs = require("fs-extra");
const os = require("os");
const xml2js = require("xml2js");
const temp = require("temp");
const byline = require("byline");
const stripAnsi = require("strip-ansi");

// Automatically track and cleanup files at exit
temp.track();

const elmTestPath = path.join(__dirname, "..", "bin", "elm-test");
const elmHome = path.join(__dirname, "..", "fixtures", "elm-home");
const spawnOpts = { silent: true, env: Object.assign({ELM_HOME: elmHome}, process.env)};

function elmTestWithYes(args, callback) {
  const child = spawn(elmTestPath, args, spawnOpts);

  child.stdin.setEncoding("utf-8");<commit_msg>Use the right binary on win32 tests.<commit_after>"use strict";

const assert = require("assert");
const path = require("path");
const shell = require("shelljs");
const spawn = require("cross-spawn");
const fs = require("fs-extra");
const os = require("os");
const xml2js = require("xml2js");
const temp = require("temp");
const byline = require("byline");
const stripAnsi = require("strip-ansi");

// Automatically track and cleanup files at exit
temp.track();

const elmHome = path.join(__dirname, "..", "fixtures", "elm-home");
const spawnOpts = { silent: true, env: Object.assign({ELM_HOME: elmHome}, process.env)};
let elmTestPath = path.join(__dirname, "..", "bin", "elm-test");

if(!fs.existsSync(elmTestPath)) {
  throw new Error("Could not find elm-test binary at:", elmTestPath);
}

// On Windows, use the locally-installed binary because
// trying to execute bin/elm-test with an absolute path
// doesn't work.
//
// TODO: can we find a way to do that? This way has the
//       downside of making it so you have to `npm install`
//       before these tests will work properly on Windows.
if (process.platform === "win32") {
  elmTestPath = "elm-test";
}

function elmTestWithYes(args, callback) {
  const child = spawn(elmTestPath, args, spawnOpts);

  child.stdin.setEncoding("utf-8");
{'fraction_non_alphanumeric': 0.16284622731614135, 'fraction_numerical': 0.004775549188156638, 'mean_word_length': 4.968660968660969, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '2171487', 'n_tokens_mistral': 654, 'n_tokens_neox': 645, 'n_words': 202}