<commit_before>var assert = require("chai").assert;
var fs = require("fs-extra");
var glob = require("glob");
var Box = require("@truffle/box");
var Profiler = require("@truffle/compile-solidity/profiler");
var Resolver = require("@truffle/resolver");
var Artifactor = require("@truffle/artifactor");

// TOOD: Move this to @truffle/compile-solidity!

describe("profiler", function () {
  var config;

  before("Create a sandbox", async () => {
    config = await Box.sandbox("default");
    config.resolver = new Resolver(config);
    config.artifactor = new Artifactor(config.contracts_build_directory);
    config.network = "development";
  });

  after("Cleanup tmp files", function (done) {
    glob("tmp-*", (err, files) => {
      if (err) done(err);
      files.forEach(file => fs.removeSync(file));
      done();
    });
  });

  it("profiles example project successfully", async () => {
    const { allSources, compilationTargets } = await Profiler.requiredSources(
      config.with({
        paths: ["./ConvertLib.sol"],
        base_path: config.contracts_directory
      })
    );
    assert.equal(Object.keys(allSources).length, 3);
    assert.equal(compilationTargets.length, 2);
  });
}).timeout(10000);
<commit_msg>Update profiler test (and change arrow functions to non-arrow)<commit_after>var assert = require("chai").assert;
var fs = require("fs-extra");
var glob = require("glob");
var Box = require("@truffle/box");
var Profiler = require("@truffle/compile-solidity/profiler");
var Resolver = require("@truffle/resolver");
var Artifactor = require("@truffle/artifactor");

// TOOD: Move this to @truffle/compile-solidity!

describe("profiler", function() {
  var config;

  before("Create a sandbox", async function() {
    config = await Box.sandbox("default");
    config.resolver = new Resolver(config);
    config.artifactor = new Artifactor(config.contracts_build_directory);
    config.network = "development";
  });

  after("Cleanup tmp files", function (done) {
    glob("tmp-*", (err, files) => {
      if (err) done(err);
      files.forEach(file => fs.removeSync(file));
      done();
    });
  });

  it("profiles example project successfully", async function() {
    const { allSources, compilationTargets } = await Profiler.requiredSources(
      config.with({
        paths: ["./ConvertLib.sol"],
        base_path: config.contracts_directory
      })
    );
    assert.equal(Object.keys(allSources).length, 2);
    assert.equal(compilationTargets.length, 2);
  });
}).timeout(10000);

{'fraction_non_alphanumeric': 0.1628367670364501, 'fraction_numerical': 0.005546751188589541, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4203357', 'n_tokens_mistral': 792, 'n_tokens_neox': 782, 'n_words': 168}