<commit_before>import fs from 'fs';
import os from 'os';
import path from 'path';

import findTestFiles from './findTestFiles';

const TMP_FILE = path.join(os.tmpdir(), 'happoEntry.js');
const pathToReactDom = path.join(__dirname, '../node_modules/react-dom');

export default function createDynamicEntryPoint({ setupScript, include }) {
  return findTestFiles(include).then(files => {
    console.log(`Found ${files.length} files.`);
    const strings = [
      `window.ReactDOM = require('${pathToReactDom}');`,
      (setupScript ? `require('${setupScript}');` : ''),
      'window.snaps = {};'
    ].concat(
      files.map(file =><commit_msg>Don't assume react-dom is in local node_modules folder<commit_after>import fs from 'fs';
import os from 'os';
import path from 'path';

import requireRelative from 'require-relative';

import findTestFiles from './findTestFiles';

const TMP_FILE = path.join(os.tmpdir(), 'happoEntry.js');
const pathToReactDom = requireRelative.resolve('react-dom', __dirname);

export default function createDynamicEntryPoint({ setupScript, include }) {
  return findTestFiles(include).then(files => {
    console.log(`Found ${files.length} files.`);
    const strings = [
      `window.ReactDOM = require('${pathToReactDom}');`,
      (setupScript ? `require('${setupScript}');` : ''),
      'window.snaps = {};'
    ].concat(
      files.map(file =>
{'fraction_non_alphanumeric': 0.16353111432706222, 'fraction_numerical': 0.0, 'mean_word_length': 4.59919028340081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '220581', 'n_tokens_mistral': 416, 'n_tokens_neox': 420, 'n_words': 99}