get rid of mocha requirement

This commit is contained in:
Iuri Matias 2017-07-02 00:27:14 -04:00
parent ccf78b4ff2
commit ec9293af60
11 changed files with 58 additions and 58 deletions

View File

@ -9,7 +9,5 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark": "^2.5.1",
"mocha": "^2.2.5"
}
}

View File

@ -1,8 +1,3 @@
var assert = require('assert');
var Embark = require('embark');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
// describe("SimpleStorage", function() {
// before(function(done) {
// this.timeout(0);

View File

@ -10,7 +10,5 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark": "^2.5.1",
"mocha": "^2.2.5"
}
}

View File

@ -1,8 +1,3 @@
var assert = require('assert');
var Embark = require('embark');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() {
before(function(done) {
this.timeout(0);

54
lib/core/run_tests.js Normal file
View File

@ -0,0 +1,54 @@
module.exports = {
run: function() {
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
var mocha = new Mocha();
var testDir = 'test/';
// Add each .js file to the mocha instance
fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
// TODO: make this a configuration in embark.json
return file.substr(-3) === '.js';
}).forEach(function(file){
mocha.addFile(
path.join(testDir, file)
);
});
let Test = require('./test.js');
global.assert = require('assert');
//global.Embark = require("../index.js");
//global.EmbarkSpec = global.Embark.initTests();
// TODO: check how to pass the options
//global.EmbarkSpec = new Test(options);
global.EmbarkSpec = new Test({});
global.web3 = global.EmbarkSpec.web3;
// Run the tests.
let runner = mocha.run(function(failures){
process.on('exit', function () {
process.exit(failures); // exit with non-zero status if there were failures
});
process.exit();
});
runner.on('suite', function() {
global.assert = require('assert');
//global.Embark = require("../index.js");
//global.EmbarkSpec = global.Embark.initTests();
// TODO: check how to pass the options
//global.EmbarkSpec = new Test(options);
global.EmbarkSpec = new Test({});
global.web3 = global.EmbarkSpec.web3;
});
}
}

View File

@ -196,32 +196,8 @@ class Embark {
}
runTests() {
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
var mocha = new Mocha();
var testDir = 'test/';
// Add each .js file to the mocha instance
fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function(file){
mocha.addFile(
path.join(testDir, file)
);
});
// Run the tests.
mocha.run(function(failures){
process.on('exit', function () {
process.exit(failures); // exit with non-zero status if there were failures
});
process.exit();
});
let RunTests = require('./core/run_tests.js');
RunTests.run();
}
}

View File

@ -22,6 +22,7 @@
"chokidar": "^1.6.0",
"colors": "^1.1.2",
"commander": "^2.8.1",
"ethereumjs-testrpc": "3.9.2",
"finalhandler": "^0.5.0",
"fs-extra": "^2.0.0",
"globule": "^1.1.0",

View File

@ -10,12 +10,10 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark": "file:../",
"mocha": "^2.2.5"
},
"dependencies": {
"embark-babel": "^1.0.0",
"embark-service": "./extensions/embark-service",
"ethereumjs-testrpc": "^3.0.3"
"ethereumjs-testrpc": "^3.9.2"
}
}

View File

@ -1,8 +1,3 @@
var assert = require('assert');
var Embark = require('embark');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("AnotherStorage", function() {
before(function(done) {
this.timeout(0);

View File

@ -1,8 +1,3 @@
var assert = require('assert');
var Embark = require('embark');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() {
before(function(done) {
this.timeout(0);

View File

@ -1,8 +1,3 @@
var assert = require('assert');
var Embark = require('embark');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("Token", function() {
before(function(done) {
this.timeout(0);