Skip to content

Commit

Permalink
Add information on how to run integration tests
Browse files Browse the repository at this point in the history
Closes #525
  • Loading branch information
bendrucker committed Oct 11, 2014
1 parent eb9b67b commit 113a7ba
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,35 @@
* Use the same coding style as the rest of the
[codebase](https://github.com/tgriesser/knex/blob/master/knex.js).

* All pull requests should be made to the `master` branch.
* All pull requests should be made to the `master` branch.

## Integration Tests

### The Easy Way

By default, Knex runs tests against MySQL (using [mysql](https://github.com/felixge/node-mysql) and [mysql2](https://github.com/sidorares/node-mysql2)), Postgres, and SQLite. The easiet way to run the tests is by creating the database `'knex_test'` and granting permissions to the database's default username:

* **MySQL**: *root*
* **Postgres**: *postgres*

No setup is required for SQLite.

### Specifying Databases
You can optionally specify which dialects to test using the `KNEX_TEST_INTEGRATION_DIALECTS` environment variable. Values shoud be space separated and can include:
* mysql
* mysql2
* postgres
* sqlite3
* maria
* oracle

```bash
$ KNEX_TEST_INTEGRATION_DIALECTS='postgres mysql' npm test
```

### Custom Configuration
If you'd like to override the database configuration (to use a different host, for example), you can override the path to the [default test configuration](https://github.com/tgriesser/knex/blob/master/test/knexfile.js) using the `KNEX_TEST` environment variable.

```bash
$ KNEX_TEST='./path/to/my/config.js' npm test
```

0 comments on commit 113a7ba

Please sign in to comment.