For Postgres, creating the database and (optionally) adding the test user this would look like:
For Postgres, creating the database and (optionally) adding the test user this would look like:
```console
```sh
$ psql
$ psql
# create database sequelize_test;
# create database sequelize_test;
# create user postgres with superuser;
# create user postgres with superuser;
```
```
**AND ONE LAST THING:** Once `npm install` worked for you (see below), you'll
#### 3.b Docker
get SQLite tests for free :)
#### 3a. Docker
Makes sure `docker` and `docker-compose` are installed.
Makes sure `docker` and `docker-compose` are installed.
...
@@ -76,41 +76,31 @@ If running on macOS, install [Docker for Mac](https://docs.docker.com/docker-for
...
@@ -76,41 +76,31 @@ If running on macOS, install [Docker for Mac](https://docs.docker.com/docker-for
Now launch the docker mysql and postgres servers with this command (you can add `-d` to run them in daemon mode):
Now launch the docker mysql and postgres servers with this command (you can add `-d` to run them in daemon mode):
```sh
```sh
docker-compose up postgres-95 mysql-57
$ docker-compose up postgres-95 mysql-57
```
Then to run the tests simply run:
```sh
npm run test-docker
```
```
**Note:** _Its possible that you wont be able to run both postgres and mysql containers at same time, this is because they share ram-disk partition. You can usually run either of them after running `sudo rm -rf /mnt/sequelize-ramdisk`_
### 4. Running tests
If sequelize is unable to connect to mysql you might want to try running `sudo docker-compose up` in a second terminal window.
### 4. Run the tests ###
All tests are located in the `test` folder (which contains the
All tests are located in the `test` folder (which contains the
$ npm run test-all ||test-mysql ||test-sqlite ||test-mssql ||test-postgres ||test-postgres-native
$ npm run test-all ||test-mysql ||test-sqlite ||test-mssql ||test-postgres ||test-postgres-native
$ # alternatively you can pass database credentials with $variables when testing
$ # alternatively you can pass database credentials with $variables when testing
$ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
$ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
```
```
#### 4a. Check the documentation
For docker users you can use these commands instead
This step only applies if you have actually changed something in the documentation. Please read [Documentation Contribution Guidelines](https://github.com/sequelize/sequelize/blob/master/CONTRIBUTING.DOCS.md) first.
To generate documentation for the `sequelize.js` file, run (in the sequelize dir)
```console
```sh
$ npm run docs
$ DIALECT=mysql npm run test-docker # Or DIALECT=postgres for Postgres SQL
```
The generated documentation will be placed in `docs/tmp.md`.
# Only integration tests
$ DIALECT=mysql npm run test-docker-integration
```
### 5. Commit ###
### 5. Commit
Sequelize follows the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.em2hiij8p46d).
Sequelize follows the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.em2hiij8p46d).
Example:
Example:
...
@@ -123,11 +113,13 @@ When you commit, your commit message will be validated automatically with [valid
...
@@ -123,11 +113,13 @@ When you commit, your commit message will be validated automatically with [valid
Then push and send your pull request. Happy hacking and thank you for contributing.
Then push and send your pull request. Happy hacking and thank you for contributing.
### Coding Guidelines ###
# Coding guidelines
Have a look at our [.eslintrc.json](https://github.com/sequelize/sequelize/blob/master/.eslintrc.json) file for the specifics. As part of the test process, all files will be linted, and your PR will **not** be accepted if it does not pass linting.
Have a look at our [.eslintrc.json](https://github.com/sequelize/sequelize/blob/master/.eslintrc.json) file for the specifics. As part of the test process, all files will be linted, and your PR will **not** be accepted if it does not pass linting.
# Publishing a release
# Publishing a release (For Maintainers)
**Note:** _You really don't need this as Sequelize use semantic-release, Travis will automatically release new version_
1. Ensure that latest build on master is green
1. Ensure that latest build on master is green
2. Ensure your local code is up to date (`git pull origin master`)
2. Ensure your local code is up to date (`git pull origin master`)