Commit 8f10465f authored by Tom JORQUERA's avatar Tom JORQUERA
Browse files

Merge branch 'issue-12' into 'master'

lib/controller: ignore test files

Closes #12

See merge request !11
parents f90399fa 1b7a292f
......@@ -14,6 +14,9 @@ module.exports = root => {
// Remove the file we already read
files.splice(files.indexOf(module + '.js'), 1);
// Ignore test files
files = files.filter(filename => !filename.endsWith('.test.js'));
Promise.all(files.map(
f => fs.readFile(root + '/' + module + '/' + f, 'utf8')
))
......
......@@ -5,10 +5,12 @@ jest.mock('mz/fs');
describe('loadModules', () => {
const MOCK_FILES = {
'/test/controller/controller.js': '1',
'/test/controller/test.js': '2',
'/test/controller/controller.test.js': 'sometest',
'/test/controller/file.js': '2',
'/test/controller/file.test.js': 'sometest',
'/test/lib/lib.js': '3',
'/test/robot/robot.js': '4',
'/test/notavalidmodule/test.js': '5'
'/test/notavalidmodule/file.js': '5'
};
beforeEach(() => {
......@@ -16,7 +18,7 @@ describe('loadModules', () => {
});
describe('loading a module', () => {
test('should include all (and only) files in its dir.', done => {
test('should include all (and only) non-test files in its dir.', done => {
const controller = require('./controller.js')('/test');
controller.load('controller')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment