How to use the @truffle/expect.options function in @truffle/expect

To help you get started, we’ve selected a few @truffle/expect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / truffle-core / lib / build.js View on Github external
build: function(options, callback) {
    expect.options(options, [
      "build_directory",
      "working_directory",
      "contracts_build_directory",
      "networks"
    ]);

    const logger = options.logger || console;
    let builder = options.build;

    // Duplicate build directory for legacy purposes
    options.destination_directory = options.build_directory;

    if (builder === null || typeof builder === "undefined") {
      logger.log(
        "No build configuration found. Preparing to compile contracts."
      );
github trufflesuite / truffle / packages / workflow-compile / utils.js View on Github external
function prepareConfig(options) {
  expect.options(options, ["contracts_build_directory"]);

  expect.one(options, ["contracts_directory", "files"]);

  // Use a config object to ensure we get the default sources.
  const config = Config.default().merge(options);

  config.compilersInfo = {};

  if (!config.resolver) config.resolver = new Resolver(config);

  if (!config.artifactor) {
    config.artifactor = new Artifactor(config.contracts_build_directory);
  }

  return config;
}
github ConsenSys / truffle-security / lib / wfc.js View on Github external
function prepareConfig(options) {
    expect.options(options, [
        'build_mythx_contracts'
    ]);

    // Use a config object to ensure we get the default sources.
    const config = Config.default().merge(options);

    config.compilersInfo = {};

    if (!config.resolver) {
        config.resolver = new Resolver(config);
    }

    return config;
}
github ConsenSys / truffle-security / compat / truffle-compile / index.js View on Github external
const compile = function(sourcePath, allSources, options, callback, isStale) {

  if (typeof options === "function") {
    callback = options;
    options = {};
  }

  if (options.logger === undefined) options.logger = console;

  const hasTargets =
    options.compilationTargets && options.compilationTargets.length;

  expect.options(options, ["contracts_directory", "compilers"]);

  expect.options(options.compilers, ["solc"]);

  options.compilers.solc.settings.evmVersion =
    options.compilers.solc.settings.evmVersion ||
    options.compilers.solc.evmVersion;

  options.compilers.solc.settings.optimizer =
    options.compilers.solc.settings.optimizer ||
    options.compilers.solc.optimizer ||
    {};

  // Ensure sources have operating system independent paths
  // i.e., convert backslashes to forward slashes; things like C: are left intact.
  const operatingSystemIndependentSources = {};
  const operatingSystemIndependentTargets = {};
  const originalPathMappings = {};
github trufflesuite / truffle / packages / core / lib / testing / testrunner.js View on Github external
function TestRunner(options = {}) {
  expect.options(options, [
    "resolver",
    "provider",
    "contracts_build_directory"
  ]);

  this.config = Config.default().merge(options);

  this.logger = options.logger || console;
  this.initial_resolver = options.resolver;
  this.provider = options.provider;

  this.can_snapshot = false;
  this.first_snapshot = true;
  this.initial_snapshot = null;
  this.known_events = {};
  this.interfaceAdapter = createInterfaceAdapter({
github trufflesuite / truffle / packages / compile-solidity / legacy / index.js View on Github external
compile.with_dependencies = function(options, callback) {
  var self = this;

  options.logger = options.logger || console;
  options.contracts_directory = options.contracts_directory || process.cwd();

  expect.options(options, [
    "paths",
    "working_directory",
    "contracts_directory",
    "resolver"
  ]);

  var config = Config.default().merge(options);

  Profiler.required_sources(
    config.with({
      paths: options.paths,
      base_path: options.contracts_directory,
      resolver: options.resolver
    }),
    (err, allSources, required) => {
      if (err) return callback(err);
github trufflesuite / truffle / packages / environment / environment.js View on Github external
detect: async function(config) {
    expect.options(config, ["networks"]);

    helpers.setUpConfig(config);
    helpers.validateNetworkConfig(config);

    const interfaceAdapter = new InterfaceAdapter({
      provider: config.provider,
      networkType: config.networks[config.network].type
    });
    const web3 = new Web3Shim({
      provider: config.provider,
      networkType: config.networks[config.network].type
    });

    await Provider.testConnection(config);
    await helpers.detectAndSetNetworkId(config, web3, interfaceAdapter);
    await helpers.setFromOnConfig(config, web3, interfaceAdapter);
github trufflesuite / truffle / packages / compile-solidity / new / index.js View on Github external
compile.with_dependencies = async function(options) {
  options.logger = options.logger || console;
  options.contracts_directory = options.contracts_directory || process.cwd();

  expect.options(options, [
    "paths",
    "working_directory",
    "contracts_directory",
    "resolver"
  ]);

  var config = Config.default().merge(options);

  const { allSources, required } = await new Promise((accept, reject) => {
    Profiler.required_sources(
      config.with({
        paths: options.paths,
        base_path: options.contracts_directory,
        resolver: options.resolver
      }),
      (err, allSources, required) => {
github trufflesuite / truffle / packages / compile-common / utils / index.js View on Github external
const updatedFiles = async options => {
  expect.options(options, ["resolver"]);

  const { contracts_directory, contracts_build_directory } = options;

  getFiles = async () => {
    if (options.files && options.files.length !== 0) return options.files;
    else return findContracts(contracts_directory);
  };

  let sourceFilesArtifacts = {};
  let sourceFilesArtifactsUpdatedTimes = {};

  try {
    const sourceFiles = await getFiles();
    sourceFilesArtifacts = readAndParseArtifactFiles(
      sourceFiles,
      contracts_build_directory
github trufflesuite / truffle / packages / environment / environment.js View on Github external
detect: async function(config) {
    expect.options(config, ["networks"]);

    helpers.setUpConfig(config);
    helpers.validateNetworkConfig(config);

    const web3 = new Web3Shim({
      provider: config.provider,
      networkType: config.networks[config.network].type
    });

    await helpers.detectAndSetNetworkId(config, web3);
    await helpers.setFromOnConfig(config, web3);
  },

@truffle/expect

Simple module for ensuring specific options are passed to a function

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular @truffle/expect functions