mirror of https://github.com/embarklabs/embark.git
first step at getting rid of mocha/embark on package.json
This commit is contained in:
parent
88c1a16453
commit
9a8a8d7da2
|
@ -139,7 +139,11 @@ class Cmd {
|
|||
.command('test')
|
||||
.description('run tests')
|
||||
.action(function () {
|
||||
shelljs.exec('mocha test');
|
||||
embark.initConfig('development', {
|
||||
embarkConfig: 'embark.json', interceptLogs: false
|
||||
});
|
||||
embark.runTests();
|
||||
//shelljs.exec('mocha test');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
28
lib/index.js
28
lib/index.js
|
@ -195,6 +195,34 @@ 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
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// temporary until next refactor
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"fs-extra": "^2.0.0",
|
||||
"globule": "^1.1.0",
|
||||
"merge": "^1.2.0",
|
||||
"mocha": "^2.2.5",
|
||||
"promptly": "^2.1.0",
|
||||
"serve-static": "^1.11.1",
|
||||
"shelljs": "^0.5.0",
|
||||
|
|
Loading…
Reference in New Issue