From e07dd93a67d21cfcbb1c035b36f1786c17ca51d6 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Wed, 18 Mar 2020 16:45:36 -0700 Subject: [PATCH] Add working coverage command --- .solcover.js | 25 +++++++++++++++++++++++++ package.json | 1 + 2 files changed, 26 insertions(+) create mode 100644 .solcover.js diff --git a/.solcover.js b/.solcover.js new file mode 100644 index 0000000..10dc4af --- /dev/null +++ b/.solcover.js @@ -0,0 +1,25 @@ +const package = require("./package.json"); +const shell = require("shelljs"); +const utils = require("solidity-coverage/plugins/resources/truffle.utils"); + +module.exports = { + port: 8545, + skipFiles: ["mcd", "interfaces"], + client: require("ganache-cli"), + providerOptions: { + network_id: package.config.ganacheNetworkID, + default_balance_ether: package.config.etherBalance, + mnemonic: package.config.mnemonic + }, + onServerReady: function() { + shell.exec("rm -rf build"); + }, + onCompileComplete: async function(config) { + shell.exec("yarn gen:contract-typings"); + shell.exec("tsc -b"); + + // Work arounds + config.test_files = await utils.getTestFilePaths(config); + process.env.npm_package_config_mnemonic = package.config.mnemonic; + } +}; diff --git a/package.json b/package.json index b918f42..13aa6ad 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "gen:contract-typings": "rm -f typings/contracts/* && typechain --target ethers --outDir typings/contracts './build/contracts/*.json'", "start": "./node_modules/.bin/ganache-cli --gasLimit 10000000 -e 10000 2>&1 > ganache-output.log & echo 'local chain started.'", "test": "tsc -b && truffle test --network ganache build/*.spec.js", + "coverage": "truffle run coverage --temp build --file='./build/*.spec.js'", "stop": "kill -9 \"$(ps -ax | grep -m1 '[n]ode ./node_modules/.bin/ganache-cli' | awk '{print $1;}')\" && echo 'local chain stopped.'", "prettier": "prettier --write" },