Merge pull request #478 from embark-framework/features/test-compile-once

compile tests only once
This commit is contained in:
Jonathan Rainville 2018-06-04 11:06:49 -04:00 committed by GitHub
commit a866cd9e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 178 deletions

View File

@ -59,6 +59,10 @@ class ContractsManager {
let self = this; let self = this;
async.waterfall([ async.waterfall([
function compileContracts(callback) { function compileContracts(callback) {
if (process.env.isTest && self.compiledContracts && Object.keys(self.compiledContracts).length) {
// Only compile once for tests
return callback();
}
self.events.request("compiler:contracts", self.contractFiles, function (err, compiledObject) { self.events.request("compiler:contracts", self.contractFiles, function (err, compiledObject) {
self.compiledContracts = compiledObject; self.compiledContracts = compiledObject;
callback(err); callback(err);

View File

@ -33,6 +33,7 @@ class Test {
this.events = new Events(); this.events = new Events();
this.ready = true; this.ready = true;
this.builtContracts = {}; this.builtContracts = {};
this.compiledContracts = {};
this.web3 = new Web3(); this.web3 = new Web3();
if (this.simOptions.node) { if (this.simOptions.node) {
@ -72,6 +73,7 @@ class Test {
const self = this; const self = this;
this.engine.contractsManager.build(() => { this.engine.contractsManager.build(() => {
self.builtContracts = cloneDeep(self.engine.contractsManager.contracts); self.builtContracts = cloneDeep(self.engine.contractsManager.contracts);
self.compiledContracts = cloneDeep(self.engine.contractsManager.compiledContracts);
callback(); callback();
}); });
} }
@ -99,6 +101,7 @@ class Test {
// Reset contracts // Reset contracts
this.engine.contractsManager.contracts = cloneDeep(this.builtContracts); this.engine.contractsManager.contracts = cloneDeep(this.builtContracts);
this.engine.contractsManager.compiledContracts = cloneDeep(this.compiledContracts);
this._deploy(options, (err, accounts) => { this._deploy(options, (err, accounts) => {
this.ready = true; this.ready = true;

264
package-lock.json generated
View File

@ -12792,7 +12792,7 @@
"webpack": { "webpack": {
"version": "3.11.0", "version": "3.11.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-3.11.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.11.0.tgz",
"integrity": "sha512-3kOFejWqj5ISpJk4Qj/V7w98h9Vl52wak3CLiw/cDOfbVTq7FeoZ0SdoHHY9PYlHr50ZS42OfvzE2vB4nncKQg==", "integrity": "sha1-d9pFGx17SxF62vQaGpO1dC8k2JQ=",
"requires": { "requires": {
"acorn": "5.5.3", "acorn": "5.5.3",
"acorn-dynamic-import": "2.0.2", "acorn-dynamic-import": "2.0.2",
@ -12818,10 +12818,50 @@
"yargs": "8.0.2" "yargs": "8.0.2"
}, },
"dependencies": { "dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wrap-ansi": "2.1.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "2.1.1"
}
}
}
},
"has-flag": { "has-flag": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8="
}, },
"supports-color": { "supports-color": {
"version": "4.5.0", "version": "4.5.0",
@ -12830,6 +12870,54 @@
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
} }
},
"tapable": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz",
"integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI="
},
"url-parse-lax": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww="
},
"yargs": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"requires": {
"camelcase": "4.1.0",
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"os-locale": "2.1.0",
"read-pkg-up": "2.0.0",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "2.1.1",
"which-module": "2.0.0",
"y18n": "3.2.1",
"yargs-parser": "7.0.0"
},
"dependencies": {
"yargs-parser": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
"requires": {
"camelcase": "4.1.0"
}
}
}
},
"yargs-parser": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz",
"integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=",
"requires": {
"camelcase": "4.1.0"
}
} }
} }
}, },
@ -12932,10 +13020,8 @@
"p-each-series": "1.0.0", "p-each-series": "1.0.0",
"p-lazy": "1.0.0", "p-lazy": "1.0.0",
"prettier": "1.13.4", "prettier": "1.13.4",
"supports-color": "5.4.0",
"v8-compile-cache": "2.0.0", "v8-compile-cache": "2.0.0",
"webpack-addons": "1.1.5", "webpack-addons": "1.1.5",
"yargs": "11.1.0",
"yeoman-environment": "2.2.0", "yeoman-environment": "2.2.0",
"yeoman-generator": "2.0.5" "yeoman-generator": "2.0.5"
}, },
@ -12964,8 +13050,7 @@
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"requires": { "requires": {
"ansi-styles": "3.2.1", "ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5"
"supports-color": "5.4.0"
} }
}, },
"cliui": { "cliui": {
@ -12974,7 +13059,6 @@
"integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
"requires": { "requires": {
"string-width": "2.1.1", "string-width": "2.1.1",
"strip-ansi": "4.0.0",
"wrap-ansi": "2.1.0" "wrap-ansi": "2.1.0"
} }
}, },
@ -13001,8 +13085,7 @@
"integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==",
"requires": { "requires": {
"graceful-fs": "4.1.11", "graceful-fs": "4.1.11",
"memory-fs": "0.4.1", "memory-fs": "0.4.1"
"tapable": "1.0.0"
} }
}, },
"got": { "got": {
@ -13025,7 +13108,6 @@
"pify": "3.0.0", "pify": "3.0.0",
"safe-buffer": "5.1.1", "safe-buffer": "5.1.1",
"timed-out": "4.0.1", "timed-out": "4.0.1",
"url-parse-lax": "3.0.0",
"url-to-options": "1.0.1" "url-to-options": "1.0.1"
} }
}, },
@ -13050,7 +13132,6 @@
"run-async": "2.3.0", "run-async": "2.3.0",
"rxjs": "5.5.11", "rxjs": "5.5.11",
"string-width": "2.1.1", "string-width": "2.1.1",
"strip-ansi": "4.0.0",
"through": "2.3.8" "through": "2.3.8"
} }
}, },
@ -13079,101 +13160,6 @@
} }
} }
}, },
"webcrypto-shim": {
"version": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8"
},
"webpack": {
"version": "3.11.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-3.11.0.tgz",
"integrity": "sha512-3kOFejWqj5ISpJk4Qj/V7w98h9Vl52wak3CLiw/cDOfbVTq7FeoZ0SdoHHY9PYlHr50ZS42OfvzE2vB4nncKQg==",
"requires": {
"acorn": "5.5.3",
"acorn-dynamic-import": "2.0.2",
"ajv": "6.2.1",
"ajv-keywords": "3.1.0",
"async": "2.6.0",
"enhanced-resolve": "3.4.1",
"escope": "3.6.0",
"interpret": "1.1.0",
"json-loader": "0.5.7",
"json5": "0.5.1",
"loader-runner": "2.3.0",
"loader-utils": "1.1.0",
"memory-fs": "0.4.1",
"mkdirp": "0.5.1",
"node-libs-browser": "2.1.0",
"source-map": "0.5.7",
"supports-color": "4.5.0",
"tapable": "0.2.8",
"uglifyjs-webpack-plugin": "0.4.6",
"watchpack": "1.6.0",
"webpack-sources": "1.1.0",
"yargs": "8.0.2"
},
"dependencies": {
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"requires": {
"ansi-regex": "3.0.0"
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"requires": {
"has-flag": "3.0.0"
}
},
"tapable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz",
"integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg=="
},
"url-parse-lax": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
"requires": {
"prepend-http": "2.0.0"
}
},
"yargs": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
"integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==",
"requires": {
"cliui": "4.1.0",
"decamelize": "1.2.0",
"find-up": "2.1.0",
"get-caller-file": "1.0.2",
"os-locale": "2.1.0",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "2.1.1",
"which-module": "2.0.0",
"y18n": "3.2.1",
"yargs-parser": "9.0.2"
}
},
"yargs-parser": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz",
"integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=",
"requires": {
"camelcase": "4.1.0"
}
}
}
},
"webpack-core": { "webpack-core": {
"version": "0.6.9", "version": "0.6.9",
"resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz", "resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz",
@ -13458,70 +13444,6 @@
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
}, },
"yargs": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"requires": {
"camelcase": "4.1.0",
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"os-locale": "2.1.0",
"read-pkg-up": "2.0.0",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "2.1.1",
"which-module": "2.0.0",
"y18n": "3.2.1",
"yargs-parser": "7.0.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wrap-ansi": "2.1.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
}
}
}
}
},
"yargs-parser": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
"requires": {
"camelcase": "4.1.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
}
}
},
"yauzl": { "yauzl": {
"version": "2.9.1", "version": "2.9.1",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.9.1.tgz", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.9.1.tgz",

View File

@ -89,7 +89,7 @@
"dom-helpers": { "dom-helpers": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.3.1.tgz", "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.3.1.tgz",
"integrity": "sha512-2Sm+JaYn74OiTM2wHvxJOo3roiq/h25Yi69Fqk269cNUwIXsCvATB6CRSFC9Am/20G2b28hGv/+7NiWydIrPvg==" "integrity": "sha1-/BpOFf/fYN3eA6SAqcD+zoId1KY="
}, },
"dotenv": { "dotenv": {
"version": "4.0.0", "version": "4.0.0",
@ -229,7 +229,7 @@
"node-fetch": { "node-fetch": {
"version": "1.7.3", "version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "integrity": "sha1-mA9vcthSEaU0fGsrwYxbhMPrR+8=",
"requires": { "requires": {
"encoding": "0.1.12", "encoding": "0.1.12",
"is-stream": "1.1.0" "is-stream": "1.1.0"
@ -252,7 +252,7 @@
"promise": { "promise": {
"version": "7.3.1", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
"integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=",
"requires": { "requires": {
"asap": "2.0.6" "asap": "2.0.6"
} }
@ -289,7 +289,7 @@
"react-bootstrap": { "react-bootstrap": {
"version": "0.32.1", "version": "0.32.1",
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.32.1.tgz", "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.32.1.tgz",
"integrity": "sha512-RbfzKUbsukWsToWqGHfCCyMFq9QQI0TznutdyxyJw6dih2NvIne25Mrssg8LZsprqtPpyQi8bN0L0Fx3fUsL8Q==", "integrity": "sha1-YGJMG0ijnXc+9szmQhpPM+zBZrs=",
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"classnames": "2.2.5", "classnames": "2.2.5",
@ -319,7 +319,7 @@
"react-overlays": { "react-overlays": {
"version": "0.8.3", "version": "0.8.3",
"resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.8.3.tgz", "resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.8.3.tgz",
"integrity": "sha512-h6GT3jgy90PgctleP39Yu3eK1v9vaJAW73GOA/UbN9dJ7aAN4BTZD6793eI1D5U+ukMk17qiqN/wl3diK1Z5LA==", "integrity": "sha1-+tZe6lskMBzKGSoWn13dsLINOsU=",
"requires": { "requires": {
"classnames": "2.2.5", "classnames": "2.2.5",
"dom-helpers": "3.3.1", "dom-helpers": "3.3.1",
@ -353,7 +353,7 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.11.1", "version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" "integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
}, },
"setimmediate": { "setimmediate": {
"version": "1.0.5", "version": "1.0.5",
@ -412,7 +412,7 @@
"zeppelin-solidity": { "zeppelin-solidity": {
"version": "1.8.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/zeppelin-solidity/-/zeppelin-solidity-1.8.0.tgz", "resolved": "https://registry.npmjs.org/zeppelin-solidity/-/zeppelin-solidity-1.8.0.tgz",
"integrity": "sha512-7Mxq6Y7EES0PSLrRF6v0EVYqBVRRo8hFrr7m3jEs69VbbQ5kpANzizeEdbP1/PWKSOmBOg208qP2vSA0FlzFLA==", "integrity": "sha1-BJ/N59rqn8hSEPjG25+M0auKhTo=",
"requires": { "requires": {
"dotenv": "4.0.0", "dotenv": "4.0.0",
"ethjs-abi": "0.2.1" "ethjs-abi": "0.2.1"