1 | ;
|
2 |
|
3 | const glob = require('glob');
|
4 | const path = require('path');
|
5 |
|
6 | const FEATURES_PATH = path.resolve(__dirname, './features');
|
7 | const FEATURES = {};
|
8 |
|
9 | glob
|
10 | .sync('*.js', { cwd: FEATURES_PATH })
|
11 | .sort()
|
12 | .forEach((filename) => {
|
13 | let key = filename.slice(0, -3);
|
14 | let value = Object.assign({}, require(`./features/${key}`));
|
15 |
|
16 | FEATURES[key] = Object.freeze(value);
|
17 | });
|
18 |
|
19 | module.exports = Object.freeze(FEATURES);
|