<commit_before>/* eslint global-require: 0, import/no-dynamic-require: 0, object-curly-newline: 0, class-methods-use-this: 0, max-len: 0 */
const fs = require('fs');
const { isSourceMap, isTypescript, ensureFilePath } = require('@after-work.js/utils');
const FileCache = require('./file-cache');

const fileCache = new FileCache();

function getBabelOpts(filename, argv) {
  const { options: { sourceRoot, only, ignore } = {}, babelPluginIstanbul } = argv.babel;
  const addCoverage = argv.instrument.testExclude.shouldInstrument(filename) && argv.virtualMock === false;
  const plugins = addCoverage
    ? [[babelPluginIstanbul, {}]]
    : [];
  const sourceMaps = 'both';
  const retainLines = true;
  return { filename, sourceRoot, plugins, only, ignore, sourceMaps, retainLines };
}

function transformTypescript(filePath, sourceRoot, tsContent, argv) {
  const { babel: { typescript } } = argv;
  const { transform: { typescript: { compilerOptions = {}, babelOptions = {} } = {} } = {} } = argv;
  const fileName = filePath;
  compilerOptions.sourceRoot = sourceRoot;
  compilerOptions.inlineSources = true;
  if (!compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
    compilerOptions.inlineSourceMap = true;
  }
  if (!compilerOptions.module) {
    compilerOptions.module = 'esnext';<commit_msg>fix: ensure adding coverage (#380)<commit_after>/* eslint global-require: 0, import/no-dynamic-require: 0, object-curly-newline: 0, class-methods-use-this: 0, max-len: 0 */
const fs = require('fs');
const { isSourceMap, isTypescript, ensureFilePath } = require('@after-work.js/utils');
const FileCache = require('./file-cache');

const fileCache = new FileCache();

function getBabelOpts(filename, argv) {
  const { options: { sourceRoot, only, ignore } = {}, babelPluginIstanbul } = argv.babel;
  const virtualMock = !!argv.virtualMock;
  const addCoverage = argv.instrument.testExclude.shouldInstrument(filename) && virtualMock === false;

  const plugins = addCoverage
    ? [[babelPluginIstanbul, {}]]
    : [];
  const sourceMaps = 'both';
  const retainLines = true;
  return { filename, sourceRoot, plugins, only, ignore, sourceMaps, retainLines };
}

function transformTypescript(filePath, sourceRoot, tsContent, argv) {
  const { babel: { typescript } } = argv;
  const { transform: { typescript: { compilerOptions = {}, babelOptions = {} } = {} } = {} } = argv;
  const fileName = filePath;
  compilerOptions.sourceRoot = sourceRoot;
  compilerOptions.inlineSources = true;
  if (!compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
    compilerOptions.inlineSourceMap = true;
  }
  if (!compilerOptions.module) {
    compilerOptions.module = 'esnext';
{'fraction_non_alphanumeric': 0.14121144555927165, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 4.8268398268398265, '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': '4417028', 'n_tokens_mistral': 824, 'n_tokens_neox': 800, 'n_words': 188}