How to use solidity-coverage - 1 common examples

To help you get started, we’ve selected a few solidity-coverage 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 AugurProject / augur / packages / augur-core / source / tools / generateCoverageReport.js View on Github external
const { execSync } = require('child_process');
const copydir = require('copy-dir');
const replace = require("replace");
const rimraf = require('rimraf');
const fs = require('fs');

const COMPILE_COMMAND = "INPUT_PATH=coverageEnv OUTPUT_PATH=coverageEnv/build/ yarn build:contracts"

const config = {
    dir: './source',
    skipFiles: [],
    copyNodeModules: false,
    compileCommand: "echo SKIPPING COMPILE"
}

const app = new App(config);

death((signal, err) => app.cleanUp(err));

rimraf.sync('./coverageEnv');
fs.mkdirSync('./coverageEnv')
copydir.sync('./source/contracts', './coverageEnv/contracts')

app.instrumentTarget();

copydir.sync('./tests/solidity_test_helpers', './coverageEnv/solidity_test_helpers')

replace({
    regex: " view | pure ",
    replacement: " ",
    paths: fs.readdirSync('./coverageEnv/solidity_test_helpers').map(filename => './coverageEnv/solidity_test_helpers/' + filename),
    silent: false,

solidity-coverage

Code coverage for Solidity testing

MIT
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis

Popular solidity-coverage functions

Similar packages