From cd0fd9438692677b874c4d6deb4acf6ba2e63ae0 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 22 Dec 2017 13:07:43 -0500 Subject: [PATCH] updatests; include options --- lib/core/run_tests.js | 16 ++++++++++++++-- lib/core/test.js | 3 ++- package.json | 2 +- test_app/test/another_storage_spec.js | 2 +- test_app/test/simple_storage_spec.js | 2 +- test_app/test/token_spec.js | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/core/run_tests.js b/lib/core/run_tests.js index 60cf5a8a..4eb10c17 100644 --- a/lib/core/run_tests.js +++ b/lib/core/run_tests.js @@ -43,6 +43,10 @@ module.exports = { //global.Embark = require("../index.js"); //global.EmbarkSpec = global.Embark.initTests(); + let configOptions = {}; + global.config = function(config) { + configOptions = config; + }; // TODO: check how to pass the options //global.EmbarkSpec = new Test(options); global.EmbarkSpec = new Test({}); @@ -66,11 +70,19 @@ module.exports = { //global.EmbarkSpec = global.Embark.initTests(); // TODO: check how to pass the options //global.EmbarkSpec = new Test(options); - global.EmbarkSpec = new Test({}); + //global.config = function(config) { + // console.log("running config!"); + // console.log(config.hello); + // configOptions = config; + //}; + + //console.log("---------"); + //console.log(configOptions); + //console.log("---------"); + global.EmbarkSpec = new Test({simulatorOptions: configOptions}); global.web3 = global.EmbarkSpec.web3; //global.contract = Mocha.describe; }); } }; - diff --git a/lib/core/test.js b/lib/core/test.js index 25c670e6..2fe7c59a 100644 --- a/lib/core/test.js +++ b/lib/core/test.js @@ -92,7 +92,8 @@ Test.prototype.deployAll = function(contractsConfig, cb) { } self.web3.eth.defaultAccount = accounts[0]; RunCode.doEval(result, self.web3); // jshint ignore:line - cb(); + //cb(); + cb(accounts); }); }); }; diff --git a/package.json b/package.json index e4ea48c6..340d4bb4 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "commander": "^2.8.1", "css-loader": "^0.28.7", "ejs": "^2.5.7", - "ethereumjs-testrpc": "3.9.2", + "ethereumjs-testrpc": "^6.0.3", "file-loader": "^1.1.5", "finalhandler": "^0.5.0", "follow-redirects": "^1.2.4", diff --git a/test_app/test/another_storage_spec.js b/test_app/test/another_storage_spec.js index d9f43e8c..1e139b7f 100644 --- a/test_app/test/another_storage_spec.js +++ b/test_app/test/another_storage_spec.js @@ -20,7 +20,7 @@ contract("AnotherStorage", function() { args: [2000] } }; - EmbarkSpec.deployAll(contractsConfig, done); + EmbarkSpec.deployAll(contractsConfig, () => { done() }); }); it("set SimpleStorage address", function(done) { diff --git a/test_app/test/simple_storage_spec.js b/test_app/test/simple_storage_spec.js index f760ae3a..22d2184d 100644 --- a/test_app/test/simple_storage_spec.js +++ b/test_app/test/simple_storage_spec.js @@ -6,7 +6,7 @@ describe("SimpleStorage", function() { args: [100] } }; - EmbarkSpec.deployAll(contractsConfig, done); + EmbarkSpec.deployAll(contractsConfig, () => { done() }); }); it("should set constructor value", function(done) { diff --git a/test_app/test/token_spec.js b/test_app/test/token_spec.js index a347447e..0f218a50 100644 --- a/test_app/test/token_spec.js +++ b/test_app/test/token_spec.js @@ -29,7 +29,7 @@ describe("Token", function() { ] } }; - EmbarkSpec.deployAll(contractsConfig, done); + EmbarkSpec.deployAll(contractsConfig, () => { done() }); }); it("not deploy Token", function(done) {