From 427c9a60c048b00d319a297c24b05a818d78337a Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Wed, 11 Jan 2017 14:17:46 +0000 Subject: [PATCH] Let's cover ourselves with istanbul Also includes the fix for #39, albeit with a changed path to the index file (README updated appropriately) --- README.md | 2 +- circle.yml | 6 +++++- package.json | 4 +++- runCoveredTests.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c70f7db..360cc45 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ From inside the SolCover directory, run ```node ./runCoveredTests.js``` -Upon completion of the tests, open the `./coverage/index.html` file to browse the HTML coverage report. +Upon completion of the tests, open the `./coverage/lcov-report/index.html` file to browse the HTML coverage report. ###A few, uh, provisos, a, a couple of quid pro quos... It is very likely that there are valid Solidity statements that this tool won't instrument correctly, as it's only been developed against a small number of contracts. If (and when) you find such cases, please raise an issue. diff --git a/circle.yml b/circle.yml index 30c8325..7ea2dbc 100644 --- a/circle.yml +++ b/circle.yml @@ -5,4 +5,8 @@ dependencies: pre: - npm install -g truffle - rm -rf node_modules/ - \ No newline at end of file +test: + override: + - npm run test-cov + post: + - bash <(curl -s https://codecov.io/bash) diff --git a/package.json b/package.json index 7d84721..4420c31 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "test" }, "scripts": { - "test": "mocha --timeout 30000" + "test": "mocha --timeout 30000", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --timeout 30000" }, "author": "", "license": "ISC", @@ -24,6 +25,7 @@ "ethereumjs-account": "~2.0.4", "ethereumjs-tx": "1.1.2", "ethereumjs-util": "~4.5.0", + "istanbul": "^0.4.5", "merkle-patricia-tree": "~2.1.2", "mocha": "^3.1.0", "solc": "0.4.6" diff --git a/runCoveredTests.js b/runCoveredTests.js index 2f61078..ca2763d 100644 --- a/runCoveredTests.js +++ b/runCoveredTests.js @@ -53,7 +53,7 @@ coverage.generate(events, './../originalContracts/'); fs.writeFileSync('./coverage.json', JSON.stringify(coverage.coverage)); -shell.exec("./node_modules/istanbul/lib/cli.js report html") +shell.exec("./node_modules/istanbul/lib/cli.js report lcov") testrpcProcess.kill(); shell.rm('-rf', './../contracts'); shell.mv('./../originalContracts', './../contracts');