Add challenge testing
This commit is contained in:
19
getChallenges.js
Normal file
19
getChallenges.js
Normal file
@ -0,0 +1,19 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
|
||||
function getFilesFor(dir) {
|
||||
return fs.readdirSync(path.join(__dirname, '/' + dir));
|
||||
}
|
||||
|
||||
module.exports = function getChallenges() {
|
||||
try {
|
||||
return getFilesFor('challenges')
|
||||
.map(function(file) {
|
||||
return require('./challenges/' + file);
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('error', e);
|
||||
return [];
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user