Skip to content

Commit

Permalink
Update test doco & add helpful errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dxg committed Jan 3, 2014
1 parent 2f6ab96 commit 15e1cc0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,20 @@ grunt migrate:up --file=001-create-users.js
## Running Tests
Create `test/config.js` (see `test/config.example.js` for instructions)
```bash
npm test
```
mocha test
This will run the tests against all configurations inside `config.js`.
To run against a single config:
```bash
ORM_PROTOCOL=mysql node test/run
# OR
ORM_PROTOCOL=mysql mocha test/integration
```
## Contributors
Locomoters:
Expand Down
7 changes: 3 additions & 4 deletions test/config.example.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// To test, rename this file to config.js and update
// the following configuration
// To test, copy this file to test/config.js and update the configuration.
//
// To run a single driver, go to root folder and do (mysql example):
// To run a single driver, go to root folder and:
// ORM_PROTOCOL=mysql node test/run
//
// To run all drivers:
// node test/run
// node test/run OR npm test

exports.mysql = {
protocol : 'mysql',
Expand Down
10 changes: 9 additions & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ module.exports = {
var protocol = this.protocol();

if (!(protocol in config)) {
return cb(new Error("Protocol '" + protocol + "' missing in config.js"));
var emsg = "";

if (!protocol) {
emsg = "No protocol specified. Specify using: ORM_PROTOCOL=mysql mocha test/integration"
} else {
emsg = "Protocol '" + protocol + "' missing in config.js"
}

return cb(new Error(emsg));
}

orm.connect(config[protocol], function (err, connection) {
Expand Down

0 comments on commit 15e1cc0

Please sign in to comment.