fix test directory without ending slash
This commit is contained in:
parent
b363873da2
commit
c1f29fdea4
|
@ -32,14 +32,23 @@ module.exports = {
|
|||
}
|
||||
|
||||
async.waterfall([
|
||||
function getFiles(next) {
|
||||
if (filePath.substr(-1) !== '/') {
|
||||
return fs.access(filePath, (err) => {
|
||||
if (err) {
|
||||
return next(`File "${filePath}" doesn't exist or you don't have permission to it`.red);
|
||||
}
|
||||
next(null, [filePath]);
|
||||
});
|
||||
function checkIfDir(next) {
|
||||
if (filePath.substr(-1) === '/') {
|
||||
return next(null, null);
|
||||
}
|
||||
fs.stat(filePath, (err, stats) => {
|
||||
if (err) {
|
||||
return next(`File "${filePath}" doesn't exist or you don't have permission to it`.red);
|
||||
}
|
||||
if (stats.isDirectory()) {
|
||||
return next(null, null);
|
||||
}
|
||||
next(null, [filePath]);
|
||||
});
|
||||
},
|
||||
function getFiles(files, next) {
|
||||
if (files) {
|
||||
return next(null, files);
|
||||
}
|
||||
getFilesFromDir(filePath, (err, files) => {
|
||||
if (err) {
|
||||
|
@ -56,7 +65,7 @@ module.exports = {
|
|||
global.assert = assert;
|
||||
global.config = test.config.bind(test);
|
||||
|
||||
let deprecatedWarning = function() {
|
||||
let deprecatedWarning = function () {
|
||||
console.error(__('%s are not supported anymore', 'EmbarkSpec & deployAll').red);
|
||||
console.info(__('You can learn about the new revamped tests here: %s', 'https://embark.status.im/docs/testing.html'.underline));
|
||||
process.exit();
|
||||
|
@ -69,7 +78,7 @@ module.exports = {
|
|||
// Override require to enable `require('Embark/contracts/contractName');`
|
||||
const Module = require('module');
|
||||
const originalRequire = require('module').prototype.require;
|
||||
Module.prototype.require = function(requireName) {
|
||||
Module.prototype.require = function (requireName) {
|
||||
if (requireName.startsWith('Embark')) {
|
||||
return test.require(...arguments);
|
||||
}
|
||||
|
@ -101,7 +110,7 @@ module.exports = {
|
|||
});
|
||||
});
|
||||
|
||||
mocha.run(function(fails) {
|
||||
mocha.run(function (fails) {
|
||||
failures += fails;
|
||||
// Mocha prints the error already
|
||||
eachCb();
|
||||
|
|
Loading…
Reference in New Issue