Skip to content

Commit

Permalink
Move system test config into own file
Browse files Browse the repository at this point in the history
This makes it easier for people to have their own database config for system
tests.
  • Loading branch information
felixge committed Oct 29, 2010
1 parent 6078975 commit eb46be9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/test/config.js
*.swo
*.un~
16 changes: 9 additions & 7 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ var path = require('path');
require.paths.unshift(path.dirname(__dirname)+'/lib');
var sys = require('mysql/sys');

global.TEST_DB = 'node_mysql_test';
global.TEST_CONFIG = {
host: 'localhost',
port: 3306,
user: 'root',
password: 'root'
};
if (module.parent.filename.match(/test\/system/)) {
try {
global.TEST_CONFIG = require('./config.js');
} catch (e) {
console.log('Skipping. See test/config.template.js for more information.');
process.exit(0);
}
}

global.TEST_DB = 'node_mysql_test';
global.TEST_TABLE = 'posts';
global.TEST_FIXTURES = path.join(__dirname, 'fixture');

Expand Down
8 changes: 8 additions & 0 deletions test/config.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copy this file to test/config.js and fill in your own credentials in order
// to run the system test suite.
module.exports = {
host: 'localhost',
port: 3306,
user: 'root',
password: 'root'
};

0 comments on commit eb46be9

Please sign in to comment.