Skip to content

Commit ec9293a

Browse files
committed
get rid of mocha requirement
1 parent ccf78b4 commit ec9293a

File tree

11 files changed

+58
-58
lines changed

11 files changed

+58
-58
lines changed

boilerplate/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@
99
"license": "ISC",
1010
"homepage": "",
1111
"devDependencies": {
12-
"embark": "^2.5.1",
13-
"mocha": "^2.2.5"
1412
}
1513
}

boilerplate/test/contract_spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
var assert = require('assert');
2-
var Embark = require('embark');
3-
var EmbarkSpec = Embark.initTests();
4-
var web3 = EmbarkSpec.web3;
5-
61
// describe("SimpleStorage", function() {
72
// before(function(done) {
83
// this.timeout(0);

demo/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010
"license": "ISC",
1111
"homepage": "",
1212
"devDependencies": {
13-
"embark": "^2.5.1",
14-
"mocha": "^2.2.5"
1513
}
1614
}

demo/test/simple_storage_spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
var assert = require('assert');
2-
var Embark = require('embark');
3-
var EmbarkSpec = Embark.initTests();
4-
var web3 = EmbarkSpec.web3;
5-
61
describe("SimpleStorage", function() {
72
before(function(done) {
83
this.timeout(0);

lib/core/run_tests.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
module.exports = {
3+
run: function() {
4+
var Mocha = require('mocha'),
5+
fs = require('fs'),
6+
path = require('path');
7+
8+
var mocha = new Mocha();
9+
10+
var testDir = 'test/';
11+
12+
// Add each .js file to the mocha instance
13+
fs.readdirSync(testDir).filter(function(file){
14+
// Only keep the .js files
15+
// TODO: make this a configuration in embark.json
16+
return file.substr(-3) === '.js';
17+
}).forEach(function(file){
18+
mocha.addFile(
19+
path.join(testDir, file)
20+
);
21+
});
22+
23+
let Test = require('./test.js');
24+
25+
global.assert = require('assert');
26+
//global.Embark = require("../index.js");
27+
//global.EmbarkSpec = global.Embark.initTests();
28+
29+
// TODO: check how to pass the options
30+
//global.EmbarkSpec = new Test(options);
31+
global.EmbarkSpec = new Test({});
32+
global.web3 = global.EmbarkSpec.web3;
33+
34+
// Run the tests.
35+
let runner = mocha.run(function(failures){
36+
process.on('exit', function () {
37+
process.exit(failures); // exit with non-zero status if there were failures
38+
});
39+
process.exit();
40+
});
41+
42+
runner.on('suite', function() {
43+
global.assert = require('assert');
44+
//global.Embark = require("../index.js");
45+
//global.EmbarkSpec = global.Embark.initTests();
46+
// TODO: check how to pass the options
47+
//global.EmbarkSpec = new Test(options);
48+
global.EmbarkSpec = new Test({});
49+
global.web3 = global.EmbarkSpec.web3;
50+
});
51+
52+
}
53+
}
54+

lib/index.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -196,32 +196,8 @@ class Embark {
196196
}
197197

198198
runTests() {
199-
var Mocha = require('mocha'),
200-
fs = require('fs'),
201-
path = require('path');
202-
203-
var mocha = new Mocha();
204-
205-
var testDir = 'test/';
206-
207-
// Add each .js file to the mocha instance
208-
fs.readdirSync(testDir).filter(function(file){
209-
// Only keep the .js files
210-
return file.substr(-3) === '.js';
211-
212-
}).forEach(function(file){
213-
mocha.addFile(
214-
path.join(testDir, file)
215-
);
216-
});
217-
218-
// Run the tests.
219-
mocha.run(function(failures){
220-
process.on('exit', function () {
221-
process.exit(failures); // exit with non-zero status if there were failures
222-
});
223-
process.exit();
224-
});
199+
let RunTests = require('./core/run_tests.js');
200+
RunTests.run();
225201
}
226202

227203
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"chokidar": "^1.6.0",
2323
"colors": "^1.1.2",
2424
"commander": "^2.8.1",
25+
"ethereumjs-testrpc": "3.9.2",
2526
"finalhandler": "^0.5.0",
2627
"fs-extra": "^2.0.0",
2728
"globule": "^1.1.0",

test_app/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
"license": "ISC",
1111
"homepage": "",
1212
"devDependencies": {
13-
"embark": "file:../",
14-
"mocha": "^2.2.5"
1513
},
1614
"dependencies": {
1715
"embark-babel": "^1.0.0",
1816
"embark-service": "./extensions/embark-service",
19-
"ethereumjs-testrpc": "^3.0.3"
17+
"ethereumjs-testrpc": "^3.9.2"
2018
}
2119
}

test_app/test/another_storage_spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
var assert = require('assert');
2-
var Embark = require('embark');
3-
var EmbarkSpec = Embark.initTests();
4-
var web3 = EmbarkSpec.web3;
5-
61
describe("AnotherStorage", function() {
72
before(function(done) {
83
this.timeout(0);

test_app/test/simple_storage_spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
var assert = require('assert');
2-
var Embark = require('embark');
3-
var EmbarkSpec = Embark.initTests();
4-
var web3 = EmbarkSpec.web3;
5-
61
describe("SimpleStorage", function() {
72
before(function(done) {
83
this.timeout(0);

0 commit comments

Comments
 (0)