var fs = require('fs'),
	fileModule = require('file'),
	testDir = '/tests',
	testFileName = 'integration_test.js';
	
process.env.INTEGRATION = true;

describe('endpoint', function() {
	it('should load the server and set everything up properly',function(done){
		this.timeout(1000); //Server should not take more than 1 sek to boot

		var app = require(process.cwd() + '/server');

		app.on('ready',function(){
			fileModule.walkSync('./endpoints', function(dirPath, dirs, files){
		        if (dirPath.indexOf(testDir) < 0) return;
		        files.forEach(function(file){
		            if (file != testFileName) return;
		            var path = dirPath + '/' + file;
		            if (!fs.existsSync(path)) return;
		            require('../../' + path);
		        });
			});
			done();
		});
	});
});

var fs = require('fs'),
  path = require('path'),
	fileModule = require('file'),
	testDir = '/tests',
	testFileName = 'integration_test.js';

	
process.env.INTEGRATION = true;

describe('endpoint', function() {
	it('should load the server and set everything up properly',function(done){
		this.timeout(1000); //Server should not take more than 1 sek to boot

		var app = require(process.cwd() + '/server');

		app.on('ready',function(){
			fileModule.walkSync('./endpoints', function(dirPath, dirs, files){
		        if (dirPath.indexOf(testDir) < 0) return;
		        files.forEach(function(file){
		            if (file != testFileName) return;
		            var fullPath = dirPath + '/' + file;
		            if (!fs.existsSync(fullPath)) return;
                if (path.extname(fullPath) !== '.js') return;
		            require('../../' + fullPath);
		        });
			});
			done();
		});
	});
});

Check the file extension before requiring a test.
Check the file extension before requiring a test.

My vim swap files kept getting caught in the test runner so I made the
change to only load up .js files.
