Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// For require('solidity-coverage/api');
const api = require("./src/api");

module.exports = api;
52 changes: 25 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,41 @@
"dependencies": {
"@solidity-parser/parser": "0.14.5",
"@syntest/core": "0.2.0",
"@truffle/config": "^1.2.44",
"@truffle/provider": "^0.1.17",
"@truffle/config": "1.3.49",
"@truffle/provider": "0.3.3",
"bignumber.js": "9.0.1",
"chalk": "^2.4.2",
"clear": "^0.1.0",
"detect-port": "^1.3.0",
"figlet": "^1.5.0",
"fs-extra": "^8.1.0",
"ganache-cli": "^6.12.2",
"chalk": "4.1.1",
"clear": "0.1.0",
"detect-port": "1.3.0",
"figlet": "1.5.2",
"fs-extra": "11.1.0",
"global-modules": "^2.0.0",
"globby": "^10.0.1",
"lodash": "^4.17.15",
"mocha": "^8.3.1",
"pify": "^4.0.1",
"globby": "^11.0.4",
"lodash.clonedeep": "4.5.0",
"mocha": "10.2.0",
"recursive-readdir": "^2.2.2",
"sc-istanbul": "^0.4.5",
"semver": "^7.3.5",
"solidity-coverage": "^0.7.16",
"truffle": "5.1.65",
"web3": "^1.3.4",
"web3-utils": "^1.5.2"
"web3": "1.8.1",
"web3-utils": "1.8.1"
},
"devDependencies": {
"@types/chai": "^4.2.15",
"@types/chai-as-promised": "^7.1.4",
"@types/mocha": "^8.2.2",
"@types/node": "^14.17.4",
"@types/sinon": "^9.0.11",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"chai": "^4.3.3",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.1.0",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.1",
"@types/mocha": "10.0.1",
"@types/node": "18.11.17",
"@types/sinon": "10.0.13",
"@typescript-eslint/eslint-plugin": "5.45.1",
"@typescript-eslint/parser": "5.45.1",
"chai": "4.3.7",
"eslint": "8.29.0",
"eslint-config-prettier": "8.5.0",
"mocha": "10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.3.2",
"sinon": "^9.2.4",
"nyc": "15.1.0",
"prettier": "2.8.1",
"sinon": "15.0.1",
"ts-node": "10.9.1",
"typescript": "4.9.4"
},
Expand Down
12 changes: 0 additions & 12 deletions src/SolidityLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ import {

const pkg = require("../package.json");
const Web3 = require("web3");
const { outputFileSync } = require("fs-extra");

export class SolidityLauncher {
private readonly _program = "syntest-solidity";
Expand Down Expand Up @@ -340,17 +339,6 @@ export class SolidityLauncher {

// Instrument
await targetPool.prepareAndInstrument(this.api);
// const instrumented = this.api.instrument(targetPool, targetPaths);

// for (const instrumentedTarget of instrumented) {
// const _path = path
// .normalize(instrumentedTarget.canonicalPath)
// .replace(
// this.config.contracts_directory,
// Properties.temp_instrumented_directory
// );
// await outputFileSync(_path, instrumentedTarget.source);
// }

this.config.contracts_directory = Properties.temp_instrumented_directory;
this.config.build_directory = this.tempArtifactsDir;
Expand Down
25 changes: 14 additions & 11 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const pify = require("pify");
const fs = require("fs");
const path = require("path");
const istanbul = require("sc-istanbul");
Expand Down Expand Up @@ -125,20 +124,20 @@ class API {
: true;

// Attach to vm step of supplied client
try {
if (this.config.forceBackupServer) throw new Error();
await this.attachToVM(client);
} catch (err) {
// Fallback to ganache-cli)
const _ganache = require("ganache-cli");
await this.attachToVM(_ganache);
}
await this.attachToVM(client);

if (autoLaunchServer === false || this.autoLaunchServer === false) {
return this.server;
}

await pify(this.server.listen)(this.port);
await new Promise((resolve, reject) => {
this.server.listen(this.port, (err) => {
if (err) {
return reject()
}
resolve()
})
})

return `http://${this.host}:${this.port}`;
}
Expand Down Expand Up @@ -190,7 +189,11 @@ class API {
*/
async finish() {
if (this.server && this.server.close) {
await pify(this.server.close)();
await new Promise((resolve) => {
this.server.close(() => {
resolve()
})
})
}
}
// ------------------------------------------ Utils ----------------------------------------------
Expand Down