From 70868de81b6a0ed48294fb098e8547ec6c581e46 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 19:29:19 +0900 Subject: [PATCH 1/8] changes undefined process.exit(code) to process.exit(9) --- lib/cmd.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cmd.js b/lib/cmd.js index a3440b97..d28a1b9d 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -33,10 +33,11 @@ Cmd.prototype.newApp = function() { .description('new application') .action(function(name, options) { if (name === undefined) { + console.log("please specify your app Name".red); console.log("e.g embark new MyApp".green); console.log("e.g embark new --help for more information".green); - process.exit(code); + process.exit(9); } self.Embark.generateTemplate('boilerplate', './', name); }); From 5525e1e9d46fd0bca42733e857d81cd625c4274e Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 22:49:42 +0900 Subject: [PATCH 2/8] add this.timeout(15000) to tests to allow the solc enough space to work --- test/compiler.js | 2 ++ test/contracts.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/compiler.js b/test/compiler.js index c44d3ed9..806da7ae 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -12,6 +12,8 @@ describe('embark.Compiler', function() { var compiler = new Compiler({logger: new TestLogger({})}); describe('#compile_solidity', function() { + this.timeout(15000); + var expectedObject = {}; expectedObject["SimpleStorage"] = {"code":"606060405234610000576040516020806100f083398101604052515b60008190555b505b60bf806100316000396000f300606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","realRuntimeBytecode": "606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820","runtimeBytecode":"606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","swarmHash": "a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe70390350007722","gasEstimates":{"creation":[20131,38200],"external":{"get()":269,"set(uint256)":20163,"storedData()":224},"internal":{}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"type":"constructor"}]}; diff --git a/test/contracts.js b/test/contracts.js index 873383a1..58a7b053 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -9,6 +9,8 @@ var readFile = function(file) { }; describe('embark.Contratcs', function() { + this.timeout(15000); + describe('simple', function() { var contractsManager = new ContractsManager({ contractFiles: [ From 895b2477cdd022c307ccda024eae5d52b701e093 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 22:52:06 +0900 Subject: [PATCH 3/8] added unit test for Embark.Cmd --- test/cmd.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/cmd.js diff --git a/test/cmd.js b/test/cmd.js new file mode 100644 index 00000000..5afe1e45 --- /dev/null +++ b/test/cmd.js @@ -0,0 +1,30 @@ +var Embark = require('../lib/index'); +var Cmd = require('../lib/cmd'); + +describe('embark.Cmd', function () { + var cmd = new Cmd(Embark); + + describe('#new', function () { + it('it should not create an app without a name', function (done) { + cmd.newApp(undefined, function (output) { + let lines = output.split('\n'); + assert.equal(lines[0], 'please specify your app Name'); + assert.equal(lines[1], 'e.g embark new MyApp'); + assert.equal(lines[2], 'e.g embark new --help for more information'); + }); + done(); + }); + + it('it should create an app with a name', function (done) { + let appname = 'deleteapp'; + cmd.newApp(appname, function (output) { + let lines = output.split('\n'); + assert.equal(lines[0], 'Initializing Embark Template....'); + assert.equal(lines[1], 'Installing packages.. this can take a few seconds'); + assert.equal(lines[2], 'Init complete'); + assert.equal(lines[3], 'App ready at ./' + appname); + }); + done(); + }); + }); +}); \ No newline at end of file From 6f5abfe07c92398df0eaba618a7da919ff66d7b5 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 22:56:27 +0900 Subject: [PATCH 4/8] swap let -> var --- test/cmd.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cmd.js b/test/cmd.js index 5afe1e45..8b64a97d 100644 --- a/test/cmd.js +++ b/test/cmd.js @@ -7,7 +7,7 @@ describe('embark.Cmd', function () { describe('#new', function () { it('it should not create an app without a name', function (done) { cmd.newApp(undefined, function (output) { - let lines = output.split('\n'); + var lines = output.split('\n'); assert.equal(lines[0], 'please specify your app Name'); assert.equal(lines[1], 'e.g embark new MyApp'); assert.equal(lines[2], 'e.g embark new --help for more information'); @@ -16,9 +16,9 @@ describe('embark.Cmd', function () { }); it('it should create an app with a name', function (done) { - let appname = 'deleteapp'; + var appname = 'deleteapp'; cmd.newApp(appname, function (output) { - let lines = output.split('\n'); + var lines = output.split('\n'); assert.equal(lines[0], 'Initializing Embark Template....'); assert.equal(lines[1], 'Installing packages.. this can take a few seconds'); assert.equal(lines[2], 'Init complete'); From 2a8fa33b840d09f947bb46db5917754c61e5588c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Tenorio-Forn=C3=A9s?= Date: Wed, 8 Mar 2017 15:18:57 +0100 Subject: [PATCH 5/8] fix typo in index.js Remove an unexpected + sign preceding a simple instruction. --- demo/app/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/app/js/index.js b/demo/app/js/index.js index cd5863c7..8b3f1bb3 100644 --- a/demo/app/js/index.js +++ b/demo/app/js/index.js @@ -93,7 +93,7 @@ $(document).ready(function() { if (err) { $("#communication .error").show(); $("#communication-controls").hide(); -+ $("#status-communication").addClass('status-offline'); + $("#status-communication").addClass('status-offline'); } else { EmbarkJS.Messages.setProvider('whisper'); $("#status-communication").addClass('status-online'); From 7a930d95a8e0f555fa9aff8fdaea790632b17e78 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 23:28:10 +0900 Subject: [PATCH 6/8] switch config to grunt vs declaring in test --- Gruntfile.coffee | 2 ++ test/compiler.js | 1 - test/contracts.js | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 24f23def..b3eb1166 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -21,6 +21,8 @@ module.exports = (grunt) -> mochaTest: test: src: ['test/**/*.js'] + options: + timeout: 0 jshint: all: ['bin/embark', 'lib/**/*.js', 'js/mine.js', 'js/embark.js'] diff --git a/test/compiler.js b/test/compiler.js index 806da7ae..19c05843 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -12,7 +12,6 @@ describe('embark.Compiler', function() { var compiler = new Compiler({logger: new TestLogger({})}); describe('#compile_solidity', function() { - this.timeout(15000); var expectedObject = {}; diff --git a/test/contracts.js b/test/contracts.js index 58a7b053..57b65bcf 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -9,7 +9,6 @@ var readFile = function(file) { }; describe('embark.Contratcs', function() { - this.timeout(15000); describe('simple', function() { var contractsManager = new ContractsManager({ From ac2a75791c6fcd2b166edabd01d26b7f380c4e81 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 23:38:08 +0900 Subject: [PATCH 7/8] grunt-config-mocha does not accept 0 as an option for timeout, so we set the value in the test itself --- test/compiler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/compiler.js b/test/compiler.js index 19c05843..9cbd1126 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -12,6 +12,7 @@ describe('embark.Compiler', function() { var compiler = new Compiler({logger: new TestLogger({})}); describe('#compile_solidity', function() { + this.timeout(0); var expectedObject = {}; From 026909aa912bf9d99d0cdc37784df669c7de6402 Mon Sep 17 00:00:00 2001 From: Todd Baur Date: Wed, 8 Mar 2017 23:41:16 +0900 Subject: [PATCH 8/8] fix other timeout issues in tests outside of core framework code --- boilerplate/test/contract_spec.js | 1 + demo/test/simple_storage_spec.js | 1 + lib/cmd.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/boilerplate/test/contract_spec.js b/boilerplate/test/contract_spec.js index ec1b8738..e732155d 100644 --- a/boilerplate/test/contract_spec.js +++ b/boilerplate/test/contract_spec.js @@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3; //describe("SimpleStorage", function() { // before(function(done) { +// this.timeout(0); // var contractsConfig = { // "SimpleStorage": { // args: [100, '0x123'] diff --git a/demo/test/simple_storage_spec.js b/demo/test/simple_storage_spec.js index 83ad1610..b2d3cb17 100644 --- a/demo/test/simple_storage_spec.js +++ b/demo/test/simple_storage_spec.js @@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3; describe("SimpleStorage", function() { before(function(done) { + this.timeout(0); var contractsConfig = { "SimpleStorage": { args: [100] diff --git a/lib/cmd.js b/lib/cmd.js index a3440b97..91d966e4 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -120,7 +120,7 @@ Cmd.prototype.test = function() { .command('test') .description('run tests') .action(function() { - shelljs.exec('mocha test/ --no-timeouts'); + shelljs.exec('mocha test'); }); };