8000 Move system test config into own file · mysqljs/mysql@eb46be9 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb46be9

Browse files
committed
Move system test config into own file
This makes it easier for people to have their own database config for system tests.
1 parent 6078975 commit eb46be9

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/test/config.js
12
*.swo
23
*.un~

test/common.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ var path = require('path');
22
require.paths.unshift(path.dirname(__dirname)+'/lib');
33
var sys = require('mysql/sys');
44

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

14+
global.TEST_DB = 'node_mysql_test';
1315
global.TEST_TABLE = 'posts';
1416
global.TEST_FIXTURES = path.join(__dirname, 'fixture');
1517

test/config.template.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copy this file to test/config.js and fill in your own credentials in order
2+
// to run the system test suite.
3+
module.exports = {
4+
host: 'localhost',
5+
port: 3306,
6+
user: 'root',
7+
password: 'root'
8+
};

0 commit comments

Comments
 (0)
0