不要怂,就是干,撸起袖子干!

Commit 83090924 by Pedro Augusto de Paula Barbosa Committed by GitHub

meta: cleanup package.json, add keywords, facilitate local development (#13290)

* meta: cleanup package.json

* meta: add some keywords to package.json

* meta: reorganize package.json scripts

* test: improve `test-unit` script in package.json

* test: refactor `rand()` function away from config

* test: cleanup config file

* meta: much better local development
1 parent 9f950cbc
...@@ -73,6 +73,7 @@ jobs: ...@@ -73,6 +73,7 @@ jobs:
- 5432:5432 - 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env: env:
SEQ_PORT: 5432
DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }} DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }}
SEQ_PG_MINIFY_ALIASES: ${{ matrix.minify-aliases && '1' || '' }} SEQ_PG_MINIFY_ALIASES: ${{ matrix.minify-aliases && '1' || '' }}
steps: steps:
...@@ -124,6 +125,7 @@ jobs: ...@@ -124,6 +125,7 @@ jobs:
- 3306:3306 - 3306:3306
options: --health-cmd="mysqladmin -usequelize_test -psequelize_test status" --health-interval 10s --health-timeout 5s --health-retries 5 --tmpfs /var/lib/mysql:rw options: --health-cmd="mysqladmin -usequelize_test -psequelize_test status" --health-interval 10s --health-timeout 5s --health-retries 5 --tmpfs /var/lib/mysql:rw
env: env:
SEQ_PORT: 3306
DIALECT: ${{ matrix.dialect }} DIALECT: ${{ matrix.dialect }}
steps: steps:
- run: mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;" - run: mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;"
...@@ -153,7 +155,7 @@ jobs: ...@@ -153,7 +155,7 @@ jobs:
ports: ports:
- 1433:1433 - 1433:1433
options: >- options: >-
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -l 30 -Q \"SELECT 1\" || exit 1" --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P \"Password12!\" -l 30 -Q \"SELECT 1\""
--health-start-period 10s --health-start-period 10s
--health-interval 10s --health-interval 10s
--health-timeout 5s --health-timeout 5s
...@@ -162,6 +164,7 @@ jobs: ...@@ -162,6 +164,7 @@ jobs:
DIALECT: mssql DIALECT: mssql
SEQ_USER: SA SEQ_USER: SA
SEQ_PW: Password12! SEQ_PW: Password12!
SEQ_PORT: 1433
steps: steps:
- run: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE sequelize_test; ALTER DATABASE sequelize_test SET READ_COMMITTED_SNAPSHOT ON;" - run: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE sequelize_test; ALTER DATABASE sequelize_test SET READ_COMMITTED_SNAPSHOT ON;"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
...@@ -187,4 +190,4 @@ jobs: ...@@ -187,4 +190,4 @@ jobs:
with: with:
node-version: 12.x node-version: 12.x
- run: npm install - run: npm install
- run: npm run semantic-release - run: npx semantic-release
'use strict';
const sequelize = require('../../../test/support').createSequelizeInstance();
(async () => {
await sequelize.authenticate();
await sequelize.close();
})();
services:
mariadb-103:
container_name: sequelize-mariadb-103
image: mariadb:10.3
environment:
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
MYSQL_ROOT_PASSWORD: sequelize_test
ports:
- 21103:3306
healthcheck:
test: ["CMD", "mysqladmin", "-usequelize_test", "-psequelize_test", "status"]
interval: 3s
timeout: 1s
retries: 10
networks:
default:
name: sequelize-mariadb-103-network
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mariadb-103 down --remove-orphans
docker-compose -p sequelize-mariadb-103 up -d
./../../wait-until-healthy.sh sequelize-mariadb-103
docker exec sequelize-mariadb-103 \
mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;"
node check.js
echo "Local MariaDB-10.3 instance is ready for Sequelize tests."
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mariadb-103 down --remove-orphans
echo "Local MariaDB-10.3 instance stopped (if it was running)."
'use strict';
const sequelize = require('../../../test/support').createSequelizeInstance();
(async () => {
await sequelize.authenticate();
await sequelize.close();
})();
services:
mssql-2019:
container_name: sequelize-mssql-2019
image: mcr.microsoft.com/mssql/server:2019-latest
environment:
ACCEPT_EULA: Y
SA_PASSWORD: Password12!
ports:
- 22019:1433
healthcheck:
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost", "-U", "SA", "-P", "Password12!", "-l", "30", "-Q", "SELECT 1"]
interval: 3s
timeout: 1s
retries: 10
networks:
default:
name: sequelize-mssql-2019-network
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mssql-2019 down --remove-orphans
docker-compose -p sequelize-mssql-2019 up -d
./../../wait-until-healthy.sh sequelize-mssql-2019
docker exec sequelize-mssql-2019 \
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE sequelize_test; ALTER DATABASE sequelize_test SET READ_COMMITTED_SNAPSHOT ON;"
node check.js
echo "Local MSSQL-2019 instance is ready for Sequelize tests."
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mssql-2019 down --remove-orphans
echo "Local MSSQL-2019 instance stopped (if it was running)."
'use strict';
const sequelize = require('../../../test/support').createSequelizeInstance();
(async () => {
await sequelize.authenticate();
await sequelize.close();
})();
services:
mysql-57:
container_name: sequelize-mysql-57
image: mysql:5.7
environment:
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
MYSQL_ROOT_PASSWORD: sequelize_test
ports:
- 20057:3306
# tmpfs: /var/lib/mysql:rw
healthcheck:
test: ["CMD", "mysqladmin", "-usequelize_test", "-psequelize_test", "status"]
interval: 3s
timeout: 1s
retries: 10
networks:
default:
name: sequelize-mysql-57-network
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mysql-57 down --remove-orphans
docker-compose -p sequelize-mysql-57 up -d
./../../wait-until-healthy.sh sequelize-mysql-57
docker exec sequelize-mysql-57 \
mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;"
node check.js
echo "Local MySQL-5.7 instance is ready for Sequelize tests."
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-mysql-57 down --remove-orphans
echo "Local MySQL-5.7 instance stopped (if it was running)."
'use strict';
const sequelize = require('../../../test/support').createSequelizeInstance();
(async () => {
await sequelize.authenticate();
await sequelize.close();
})();
services:
postgres-10:
container_name: sequelize-postgres-10
image: sushantdhiman/postgres:10
environment:
POSTGRES_USER: sequelize_test
POSTGRES_PASSWORD: sequelize_test
POSTGRES_DB: sequelize_test
ports:
- 23010:5432
healthcheck:
test: ["CMD", "pg_isready", "-U", "sequelize_test"]
interval: 3s
timeout: 1s
retries: 10
networks:
default:
name: sequelize-postgres-10-network
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-postgres-10 down --remove-orphans
docker-compose -p sequelize-postgres-10 up -d
./../../wait-until-healthy.sh sequelize-postgres-10
# docker exec sequelize-postgres-10 \
# bash -c "export PGPASSWORD=sequelize_test && psql -h localhost -p 5432 -U sequelize_test sequelize_test -c '\l'"
echo "Local Postgres-10 instance is ready for Sequelize tests."
#!/usr/bin/env bash
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637
docker-compose -p sequelize-postgres-10 down --remove-orphans
echo "Local Postgres-10 instance stopped (if it was running)."
import { Sequelize, Options } from '..';
export declare function createSequelizeInstance(options?: Options): Sequelize;
'use strict';
const Support = require('../test/support');
module.exports = {
createSequelizeInstance(options = {}) {
return Support.createSequelizeInstance({
logging: console.log,
logQueryParameters: true,
...options
});
}
};
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
>&2 echo "Please provide the container name or hash"
exit 1
fi
for _ in {1..50}
do
state=$(docker inspect -f '{{ .State.Health.Status }}' $1 2>&1)
return_code=$?
if [ ${return_code} -eq 0 ] && [ "$state" == "healthy" ]; then
echo "$1 is healthy!"
exit 0
fi
sleep 0.4
done
>&2 echo "Timeout of 20s exceeded when waiting for container to be healthy: $1"
exit 1
version: '2'
services:
sequelize:
build: .
links:
- mysql-57
- postgres-95
volumes:
- .:/sequelize
environment:
SEQ_DB: sequelize_test
SEQ_USER: sequelize_test
SEQ_PW: sequelize_test
# PostgreSQL
postgres-95:
image: sushantdhiman/postgres:9.5
environment:
POSTGRES_USER: sequelize_test
POSTGRES_PASSWORD: sequelize_test
POSTGRES_DB: sequelize_test
ports:
- "8990:5432"
container_name: postgres-95
postgres-10:
image: sushantdhiman/postgres:10
environment:
POSTGRES_USER: sequelize_test
POSTGRES_PASSWORD: sequelize_test
POSTGRES_DB: sequelize_test
ports:
- "8991:5432"
container_name: postgres-10
postgres-12:
image: sushantdhiman/postgres:12
environment:
POSTGRES_USER: sequelize_test
POSTGRES_PASSWORD: sequelize_test
POSTGRES_DB: sequelize_test
ports:
- "8992:5432"
container_name: postgres-12
# MariaDB
mariadb-103:
image: mariadb:10.3
environment:
MYSQL_ROOT_PASSWORD: lollerskates
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
volumes:
- $MARIADB_ENTRYPOINT/:/docker-entrypoint-initdb.d
ports:
- "8960:3306"
container_name: mariadb-103
# MySQL
mysql-57:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: lollerskates
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
volumes:
- $MYSQLDB_ENTRYPOINT/:/docker-entrypoint-initdb.d
ports:
- "8980:3306"
container_name: mysql-57
# MSSQL
mssql:
image: microsoft/mssql-server-linux:latest
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: yourStrong(!)Password
ports:
- "8970:1433"
container_name: mssql
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
"cls-hooked": "^4.2.2", "cls-hooked": "^4.2.2",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"delay": "^4.3.0", "delay": "^4.3.0",
"env-cmd": "^10.1.0",
"esdoc": "^1.1.0", "esdoc": "^1.1.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0", "esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-inject-style-plugin": "^1.0.0", "esdoc-inject-style-plugin": "^1.0.0",
...@@ -118,14 +117,16 @@ ...@@ -118,14 +117,16 @@
"sqlite", "sqlite",
"postgresql", "postgresql",
"postgres", "postgres",
"pg",
"mssql", "mssql",
"sql",
"sqlserver",
"orm", "orm",
"nodejs", "nodejs",
"object relational mapper" "object relational mapper",
"database",
"db"
], ],
"options": {
"env_cmd": "-f ./test/config/.docker.env"
},
"commitlint": { "commitlint": {
"extends": [ "extends": [
"@commitlint/config-angular" "@commitlint/config-angular"
...@@ -172,51 +173,62 @@ ...@@ -172,51 +173,62 @@
"tag": "latest" "tag": "latest"
}, },
"scripts": { "scripts": {
"----------------------------------------- static analysis -----------------------------------------": "",
"lint": "eslint lib test --quiet", "lint": "eslint lib test --quiet",
"lint-docs": "markdownlint docs", "lint-docs": "markdownlint docs",
"test": "npm run teaser && npm run test-unit && npm run test-integration", "test-typings": "tsc -b types/tsconfig.json && tsc -b types/test/tsconfig.json",
"test-docker": "npm run test-docker-unit && npm run test-docker-integration", "----------------------------------------- documentation -------------------------------------------": "",
"test-docker-unit": "npm run test-unit",
"test-docker-integration": "env-cmd $npm_package_options_env_cmd npm run test-integration",
"docs": "rimraf esdoc && esdoc -c docs/esdoc-config.js && cp docs/favicon.ico esdoc/favicon.ico && cp docs/ROUTER.txt esdoc/ROUTER && node docs/run-docs-transforms.js && node docs/redirects/create-redirects.js && rimraf esdoc/file esdoc/source.html", "docs": "rimraf esdoc && esdoc -c docs/esdoc-config.js && cp docs/favicon.ico esdoc/favicon.ico && cp docs/ROUTER.txt esdoc/ROUTER && node docs/run-docs-transforms.js && node docs/redirects/create-redirects.js && rimraf esdoc/file esdoc/source.html",
"teaser": "node scripts/teaser", "----------------------------------------- tests ---------------------------------------------------": "",
"test-unit": "mocha --globals setImmediate,clearImmediate --exit --check-leaks --colors -t 30000 --reporter spec \"test/unit/**/*.js\"", "test-unit": "mocha --exit --check-leaks --colors -t 30000 --reporter spec \"test/unit/**/*.test.js\"",
"test-integration": "mocha --exit --check-leaks --colors -t 30000 --reporter spec \"test/integration/**/*.test.js\"",
"teaser": "node test/teaser.js",
"test": "npm run teaser && npm run test-unit && npm run test-integration",
"----------------------------------------- coverage ------------------------------------------------": "",
"cover": "rimraf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage",
"cover-integration": "cross-env COVERAGE=true nyc --reporter=lcovonly mocha -t 30000 --exit \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "cross-env COVERAGE=true nyc --reporter=lcovonly mocha -t 30000 --exit \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"",
"----------------------------------------- local test dbs ------------------------------------------": "",
"start-mariadb": "bash dev/mariadb/10.3/start.sh",
"start-mysql": "bash dev/mysql/5.7/start.sh",
"start-postgres": "bash dev/postgres/10/start.sh",
"start-mssql": "bash dev/mssql/2019/start.sh",
"stop-mariadb": "bash dev/mariadb/10.3/stop.sh",
"stop-mysql": "bash dev/mysql/5.7/stop.sh",
"stop-postgres": "bash dev/postgres/10/stop.sh",
"stop-mssql": "bash dev/mssql/2019/stop.sh",
"restart-mariadb": "npm run start-mariadb",
"restart-mysql": "npm run start-mysql",
"restart-postgres": "npm run start-postgres",
"restart-mssql": "npm run start-mssql",
"----------------------------------------- local tests ---------------------------------------------": "",
"test-unit-mariadb": "cross-env DIALECT=mariadb npm run test-unit", "test-unit-mariadb": "cross-env DIALECT=mariadb npm run test-unit",
"test-unit-mysql": "cross-env DIALECT=mysql npm run test-unit", "test-unit-mysql": "cross-env DIALECT=mysql npm run test-unit",
"test-unit-postgres": "cross-env DIALECT=postgres npm run test-unit", "test-unit-postgres": "cross-env DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "cross-env DIALECT=postgres-native npm run test-unit", "test-unit-postgres-native": "cross-env DIALECT=postgres-native npm run test-unit",
"test-unit-sqlite": "cross-env DIALECT=sqlite npm run test-unit", "test-unit-sqlite": "cross-env DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "cross-env DIALECT=mssql npm run test-unit", "test-unit-mssql": "cross-env DIALECT=mssql npm run test-unit",
"test-unit-all": "npm run test-unit-mariadb && npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite",
"test-integration": "mocha --globals setImmediate,clearImmediate --exit --check-leaks --colors -t 30000 --reporter spec \"test/integration/**/*.test.js\"",
"test-integration-mariadb": "cross-env DIALECT=mariadb npm run test-integration", "test-integration-mariadb": "cross-env DIALECT=mariadb npm run test-integration",
"test-integration-mysql": "cross-env DIALECT=mysql npm run test-integration", "test-integration-mysql": "cross-env DIALECT=mysql npm run test-integration",
"test-integration-postgres": "cross-env DIALECT=postgres npm run test-integration", "test-integration-postgres": "cross-env DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "cross-env DIALECT=postgres-native npm run test-integration", "test-integration-postgres-native": "cross-env DIALECT=postgres-native npm run test-integration",
"test-integration-sqlite": "cross-env DIALECT=sqlite npm run test-integration", "test-integration-sqlite": "cross-env DIALECT=sqlite npm run test-integration",
"test-integration-mssql": "cross-env DIALECT=mssql npm run test-integration", "test-integration-mssql": "cross-env DIALECT=mssql npm run test-integration",
"test-integration-all": "npm run test-integration-mariadb && npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite",
"test-mariadb": "cross-env DIALECT=mariadb npm test", "test-mariadb": "cross-env DIALECT=mariadb npm test",
"test-mysql": "cross-env DIALECT=mysql npm test", "test-mysql": "cross-env DIALECT=mysql npm test",
"test-sqlite": "cross-env DIALECT=sqlite npm test", "test-sqlite": "cross-env DIALECT=sqlite npm test",
"test-postgres": "cross-env DIALECT=postgres npm test", "test-postgres": "cross-env DIALECT=postgres npm test",
"test-pgsql": "npm run test-postgres",
"test-postgres-native": "cross-env DIALECT=postgres-native npm test", "test-postgres-native": "cross-env DIALECT=postgres-native npm test",
"test-postgresn": "npm run test-postgres-native",
"test-mssql": "cross-env DIALECT=mssql npm test", "test-mssql": "cross-env DIALECT=mssql npm test",
"test-all": "npm run test-mariadb && npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql", "----------------------------------------- development ---------------------------------------------": "",
"test-typings": "tsc -b types/tsconfig.json && tsc -b types/test/tsconfig.json", "sscce": "node sscce.js",
"cover": "rimraf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage", "sscce-mariadb": "cross-env DIALECT=mariadb node sscce.js",
"cover-integration": "cross-env COVERAGE=true nyc --reporter=lcovonly mocha -t 30000 --exit \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"", "sscce-mysql": "cross-env DIALECT=mysql node sscce.js",
"cover-unit": "cross-env COVERAGE=true nyc --reporter=lcovonly mocha -t 30000 --exit \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"", "sscce-postgres": "cross-env DIALECT=postgres node sscce.js",
"merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"", "sscce-postgres-native": "cross-env DIALECT=postgres-native node sscce.js",
"sscce": "env-cmd $npm_package_options_env_cmd node sscce.js", "sscce-sqlite": "cross-env DIALECT=sqlite node sscce.js",
"sscce-mariadb": "cross-env DIALECT=mariadb npm run sscce", "sscce-mssql": "cross-env DIALECT=mssql node sscce.js",
"sscce-mysql": "cross-env DIALECT=mysql npm run sscce", "---------------------------------------------------------------------------------------------------": ""
"sscce-postgres": "cross-env DIALECT=postgres npm run sscce",
"sscce-sqlite": "cross-env DIALECT=sqlite npm run sscce",
"sscce-mssql": "cross-env DIALECT=mssql npm run sscce",
"setup-mssql": "env-cmd $npm_package_options_env_cmd ./scripts/setup-mssql",
"semantic-release": "semantic-release"
} }
} }
docker exec mssql /bin/bash -c '/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U "sa" -d "master" -P '"'$SEQ_MSSQL_PW'"' -Q "DROP DATABASE ['$SEQ_MSSQL_DB']; CREATE DATABASE ['$SEQ_MSSQL_DB']; ALTER DATABASE ['$SEQ_MSSQL_DB'] SET READ_COMMITTED_SNAPSHOT ON;"'
\ No newline at end of file
'use strict';
const { createSequelizeInstance } = require('./dev/sscce-helpers');
const { Model, DataTypes } = require('.');
const sequelize = createSequelizeInstance({ benchmark: true });
class User extends Model {}
User.init({
username: DataTypes.STRING,
birthday: DataTypes.DATE
}, { sequelize, modelName: 'user' });
(async () => {
await sequelize.sync({ force: true });
const jane = await User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20)
});
console.log('\nJane:', jane.toJSON());
await sequelize.close();
})();
'use strict';
/*
* Copy this file to ./sscce.js
* Add code from issue
* npm run sscce-{dialect}
*/
const Sequelize = require('./index');
const sequelize = require('./test/support').createSequelizeInstance();
...@@ -3,24 +3,11 @@ ...@@ -3,24 +3,11 @@
const { env } = process; const { env } = process;
module.exports = { module.exports = {
username: env.SEQ_USER || 'root',
password: env.SEQ_PW || null,
database: env.SEQ_DB || 'sequelize_test',
host: env.SEQ_HOST || '127.0.0.1',
pool: {
max: env.SEQ_POOL_MAX || 5,
idle: env.SEQ_POOL_IDLE || 30000
},
rand() {
return parseInt(Math.random() * 999, 10);
},
mssql: { mssql: {
host: env.SEQ_MSSQL_HOST || env.SEQ_HOST || 'localhost', host: env.SEQ_MSSQL_HOST || env.SEQ_HOST || 'localhost',
username: env.SEQ_MSSQL_USER || env.SEQ_USER || 'SA', username: env.SEQ_MSSQL_USER || env.SEQ_USER || 'SA',
password: env.SEQ_MSSQL_PW || env.SEQ_PW || 'Password12!', password: env.SEQ_MSSQL_PW || env.SEQ_PW || 'Password12!',
port: env.SEQ_MSSQL_PORT || env.SEQ_PORT || 1433, port: env.SEQ_MSSQL_PORT || env.SEQ_PORT || 22019,
database: env.SEQ_MSSQL_DB || env.SEQ_DB || 'sequelize_test', database: env.SEQ_MSSQL_DB || env.SEQ_DB || 'sequelize_test',
dialectOptions: { dialectOptions: {
options: { options: {
...@@ -34,13 +21,12 @@ module.exports = { ...@@ -34,13 +21,12 @@ module.exports = {
} }
}, },
//make idle time small so that tests exit promptly
mysql: { mysql: {
database: env.SEQ_MYSQL_DB || env.SEQ_DB || 'sequelize_test', database: env.SEQ_MYSQL_DB || env.SEQ_DB || 'sequelize_test',
username: env.SEQ_MYSQL_USER || env.SEQ_USER || 'root', username: env.SEQ_MYSQL_USER || env.SEQ_USER || 'sequelize_test',
password: env.SEQ_MYSQL_PW || env.SEQ_PW || null, password: env.SEQ_MYSQL_PW || env.SEQ_PW || 'sequelize_test',
host: env.MYSQL_PORT_3306_TCP_ADDR || env.SEQ_MYSQL_HOST || env.SEQ_HOST || '127.0.0.1', host: env.MYSQL_PORT_3306_TCP_ADDR || env.SEQ_MYSQL_HOST || env.SEQ_HOST || '127.0.0.1',
port: env.MYSQL_PORT_3306_TCP_PORT || env.SEQ_MYSQL_PORT || env.SEQ_PORT || 3306, port: env.MYSQL_PORT_3306_TCP_PORT || env.SEQ_MYSQL_PORT || env.SEQ_PORT || 20057,
pool: { pool: {
max: env.SEQ_MYSQL_POOL_MAX || env.SEQ_POOL_MAX || 5, max: env.SEQ_MYSQL_POOL_MAX || env.SEQ_POOL_MAX || 5,
idle: env.SEQ_MYSQL_POOL_IDLE || env.SEQ_POOL_IDLE || 3000 idle: env.SEQ_MYSQL_POOL_IDLE || env.SEQ_POOL_IDLE || 3000
...@@ -49,10 +35,10 @@ module.exports = { ...@@ -49,10 +35,10 @@ module.exports = {
mariadb: { mariadb: {
database: env.SEQ_MARIADB_DB || env.SEQ_DB || 'sequelize_test', database: env.SEQ_MARIADB_DB || env.SEQ_DB || 'sequelize_test',
username: env.SEQ_MARIADB_USER || env.SEQ_USER || 'root', username: env.SEQ_MARIADB_USER || env.SEQ_USER || 'sequelize_test',
password: env.SEQ_MARIADB_PW || env.SEQ_PW || null, password: env.SEQ_MARIADB_PW || env.SEQ_PW || 'sequelize_test',
host: env.MARIADB_PORT_3306_TCP_ADDR || env.SEQ_MARIADB_HOST || env.SEQ_HOST || '127.0.0.1', host: env.MARIADB_PORT_3306_TCP_ADDR || env.SEQ_MARIADB_HOST || env.SEQ_HOST || '127.0.0.1',
port: env.MARIADB_PORT_3306_TCP_PORT || env.SEQ_MARIADB_PORT || env.SEQ_PORT || 3306, port: env.MARIADB_PORT_3306_TCP_PORT || env.SEQ_MARIADB_PORT || env.SEQ_PORT || 21103,
pool: { pool: {
max: env.SEQ_MARIADB_POOL_MAX || env.SEQ_POOL_MAX || 5, max: env.SEQ_MARIADB_POOL_MAX || env.SEQ_POOL_MAX || 5,
idle: env.SEQ_MARIADB_POOL_IDLE || env.SEQ_POOL_IDLE || 3000 idle: env.SEQ_MARIADB_POOL_IDLE || env.SEQ_POOL_IDLE || 3000
...@@ -63,10 +49,10 @@ module.exports = { ...@@ -63,10 +49,10 @@ module.exports = {
postgres: { postgres: {
database: env.SEQ_PG_DB || env.SEQ_DB || 'sequelize_test', database: env.SEQ_PG_DB || env.SEQ_DB || 'sequelize_test',
username: env.SEQ_PG_USER || env.SEQ_USER || 'postgres', username: env.SEQ_PG_USER || env.SEQ_USER || 'sequelize_test',
password: env.SEQ_PG_PW || env.SEQ_PW || 'postgres', password: env.SEQ_PG_PW || env.SEQ_PW || 'sequelize_test',
host: env.POSTGRES_PORT_5432_TCP_ADDR || env.SEQ_PG_HOST || env.SEQ_HOST || '127.0.0.1', host: env.POSTGRES_PORT_5432_TCP_ADDR || env.SEQ_PG_HOST || env.SEQ_HOST || '127.0.0.1',
port: env.POSTGRES_PORT_5432_TCP_PORT || env.SEQ_PG_PORT || env.SEQ_PORT || 5432, port: env.POSTGRES_PORT_5432_TCP_PORT || env.SEQ_PG_PORT || env.SEQ_PORT || 23010,
pool: { pool: {
max: env.SEQ_PG_POOL_MAX || env.SEQ_POOL_MAX || 5, max: env.SEQ_PG_POOL_MAX || env.SEQ_POOL_MAX || 5,
idle: env.SEQ_PG_POOL_IDLE || env.SEQ_POOL_IDLE || 3000 idle: env.SEQ_PG_POOL_IDLE || env.SEQ_POOL_IDLE || 3000
......
...@@ -4,14 +4,13 @@ const chai = require('chai'), ...@@ -4,14 +4,13 @@ const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Support = require('../../support'), Support = require('../../support'),
dialect = Support.getTestDialect(), dialect = Support.getTestDialect(),
DataTypes = require('../../../../lib/data-types'), DataTypes = require('../../../../lib/data-types');
config = require('../../../config/config');
if (dialect !== 'mariadb') return; if (dialect !== 'mariadb') return;
describe('[MariaDB Specific] DAOFactory', () => { describe('[MariaDB Specific] DAOFactory', () => {
describe('constructor', () => { describe('constructor', () => {
it('handles extended attributes (unique)', function() { it('handles extended attributes (unique)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, unique: true } username: { type: DataTypes.STRING, unique: true }
}, { timestamps: false }); }, { timestamps: false });
...@@ -24,7 +23,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -24,7 +23,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('handles extended attributes (default)', function() { it('handles extended attributes (default)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, defaultValue: 'foo' } username: { type: DataTypes.STRING, defaultValue: 'foo' }
}, { timestamps: false }); }, { timestamps: false });
expect( expect(
...@@ -36,7 +35,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -36,7 +35,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('handles extended attributes (null)', function() { it('handles extended attributes (null)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, allowNull: false } username: { type: DataTypes.STRING, allowNull: false }
}, { timestamps: false }); }, { timestamps: false });
expect( expect(
...@@ -48,7 +47,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -48,7 +47,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('handles extended attributes (primaryKey)', function() { it('handles extended attributes (primaryKey)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, primaryKey: true } username: { type: DataTypes.STRING, primaryKey: true }
}, { timestamps: false }); }, { timestamps: false });
expect( expect(
...@@ -58,8 +57,8 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -58,8 +57,8 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('adds timestamps', function() { it('adds timestamps', function() {
const User1 = this.sequelize.define(`User${config.rand()}`, {}); const User1 = this.sequelize.define(`User${Support.rand()}`, {});
const User2 = this.sequelize.define(`User${config.rand()}`, {}, const User2 = this.sequelize.define(`User${Support.rand()}`, {},
{ timestamps: true }); { timestamps: true });
expect( expect(
...@@ -79,7 +78,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -79,7 +78,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('adds deletedAt if paranoid', function() { it('adds deletedAt if paranoid', function() {
const User = this.sequelize.define(`User${config.rand()}`, {}, const User = this.sequelize.define(`User${Support.rand()}`, {},
{ paranoid: true }); { paranoid: true });
expect( expect(
this.sequelize.getQueryInterface().queryGenerator.attributesToSQL( this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(
...@@ -92,7 +91,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -92,7 +91,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('underscores timestamps if underscored', function() { it('underscores timestamps if underscored', function() {
const User = this.sequelize.define(`User${config.rand()}`, {}, const User = this.sequelize.define(`User${Support.rand()}`, {},
{ paranoid: true, underscored: true }); { paranoid: true, underscored: true });
expect( expect(
this.sequelize.getQueryInterface().queryGenerator.attributesToSQL( this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(
...@@ -105,13 +104,13 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -105,13 +104,13 @@ describe('[MariaDB Specific] DAOFactory', () => {
}); });
it('omits text fields with defaultValues', function() { it('omits text fields with defaultValues', function() {
const User = this.sequelize.define(`User${config.rand()}`, const User = this.sequelize.define(`User${Support.rand()}`,
{ name: { type: DataTypes.TEXT, defaultValue: 'helloworld' } }); { name: { type: DataTypes.TEXT, defaultValue: 'helloworld' } });
expect(User.rawAttributes.name.type.toString()).to.equal('TEXT'); expect(User.rawAttributes.name.type.toString()).to.equal('TEXT');
}); });
it('omits blobs fields with defaultValues', function() { it('omits blobs fields with defaultValues', function() {
const User = this.sequelize.define(`User${config.rand()}`, const User = this.sequelize.define(`User${Support.rand()}`,
{ name: { type: DataTypes.STRING.BINARY, defaultValue: 'helloworld' } }); { name: { type: DataTypes.STRING.BINARY, defaultValue: 'helloworld' } });
expect(User.rawAttributes.name.type.toString()).to.equal( expect(User.rawAttributes.name.type.toString()).to.equal(
'VARCHAR(255) BINARY'); 'VARCHAR(255) BINARY');
...@@ -120,7 +119,7 @@ describe('[MariaDB Specific] DAOFactory', () => { ...@@ -120,7 +119,7 @@ describe('[MariaDB Specific] DAOFactory', () => {
describe('primaryKeys', () => { describe('primaryKeys', () => {
it('determines the correct primaryKeys', function() { it('determines the correct primaryKeys', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
foo: { type: DataTypes.STRING, primaryKey: true }, foo: { type: DataTypes.STRING, primaryKey: true },
bar: DataTypes.STRING bar: DataTypes.STRING
}); });
......
...@@ -4,14 +4,13 @@ const chai = require('chai'), ...@@ -4,14 +4,13 @@ const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Support = require('../../support'), Support = require('../../support'),
dialect = Support.getTestDialect(), dialect = Support.getTestDialect(),
DataTypes = require('../../../../lib/data-types'), DataTypes = require('../../../../lib/data-types');
config = require('../../../config/config');
if (dialect === 'mysql') { if (dialect === 'mysql') {
describe('[MYSQL Specific] DAOFactory', () => { describe('[MYSQL Specific] DAOFactory', () => {
describe('constructor', () => { describe('constructor', () => {
it('handles extended attributes (unique)', function() { it('handles extended attributes (unique)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, unique: true } username: { type: DataTypes.STRING, unique: true }
}, { timestamps: false }); }, { timestamps: false });
...@@ -19,58 +18,58 @@ if (dialect === 'mysql') { ...@@ -19,58 +18,58 @@ if (dialect === 'mysql') {
}); });
it('handles extended attributes (default)', function() { it('handles extended attributes (default)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, defaultValue: 'foo' } username: { type: DataTypes.STRING, defaultValue: 'foo' }
}, { timestamps: false }); }, { timestamps: false });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: "VARCHAR(255) DEFAULT 'foo'", id: 'INTEGER NOT NULL auto_increment PRIMARY KEY' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: "VARCHAR(255) DEFAULT 'foo'", id: 'INTEGER NOT NULL auto_increment PRIMARY KEY' });
}); });
it('handles extended attributes (null)', function() { it('handles extended attributes (null)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, allowNull: false } username: { type: DataTypes.STRING, allowNull: false }
}, { timestamps: false }); }, { timestamps: false });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: 'VARCHAR(255) NOT NULL', id: 'INTEGER NOT NULL auto_increment PRIMARY KEY' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: 'VARCHAR(255) NOT NULL', id: 'INTEGER NOT NULL auto_increment PRIMARY KEY' });
}); });
it('handles extended attributes (primaryKey)', function() { it('handles extended attributes (primaryKey)', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
username: { type: DataTypes.STRING, primaryKey: true } username: { type: DataTypes.STRING, primaryKey: true }
}, { timestamps: false }); }, { timestamps: false });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: 'VARCHAR(255) PRIMARY KEY' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ username: 'VARCHAR(255) PRIMARY KEY' });
}); });
it('adds timestamps', function() { it('adds timestamps', function() {
const User1 = this.sequelize.define(`User${config.rand()}`, {}); const User1 = this.sequelize.define(`User${Support.rand()}`, {});
const User2 = this.sequelize.define(`User${config.rand()}`, {}, { timestamps: true }); const User2 = this.sequelize.define(`User${Support.rand()}`, {}, { timestamps: true });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User1.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User1.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User2.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User2.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' });
}); });
it('adds deletedAt if paranoid', function() { it('adds deletedAt if paranoid', function() {
const User = this.sequelize.define(`User${config.rand()}`, {}, { paranoid: true }); const User = this.sequelize.define(`User${Support.rand()}`, {}, { paranoid: true });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', deletedAt: 'DATETIME', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', deletedAt: 'DATETIME', updatedAt: 'DATETIME NOT NULL', createdAt: 'DATETIME NOT NULL' });
}); });
it('underscores timestamps if underscored', function() { it('underscores timestamps if underscored', function() {
const User = this.sequelize.define(`User${config.rand()}`, {}, { paranoid: true, underscored: true }); const User = this.sequelize.define(`User${Support.rand()}`, {}, { paranoid: true, underscored: true });
expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', deleted_at: 'DATETIME', updated_at: 'DATETIME NOT NULL', created_at: 'DATETIME NOT NULL' }); expect(this.sequelize.getQueryInterface().queryGenerator.attributesToSQL(User.rawAttributes)).to.deep.equal({ id: 'INTEGER NOT NULL auto_increment PRIMARY KEY', deleted_at: 'DATETIME', updated_at: 'DATETIME NOT NULL', created_at: 'DATETIME NOT NULL' });
}); });
it('omits text fields with defaultValues', function() { it('omits text fields with defaultValues', function() {
const User = this.sequelize.define(`User${config.rand()}`, { name: { type: DataTypes.TEXT, defaultValue: 'helloworld' } }); const User = this.sequelize.define(`User${Support.rand()}`, { name: { type: DataTypes.TEXT, defaultValue: 'helloworld' } });
expect(User.rawAttributes.name.type.toString()).to.equal('TEXT'); expect(User.rawAttributes.name.type.toString()).to.equal('TEXT');
}); });
it('omits blobs fields with defaultValues', function() { it('omits blobs fields with defaultValues', function() {
const User = this.sequelize.define(`User${config.rand()}`, { name: { type: DataTypes.STRING.BINARY, defaultValue: 'helloworld' } }); const User = this.sequelize.define(`User${Support.rand()}`, { name: { type: DataTypes.STRING.BINARY, defaultValue: 'helloworld' } });
expect(User.rawAttributes.name.type.toString()).to.equal('VARCHAR(255) BINARY'); expect(User.rawAttributes.name.type.toString()).to.equal('VARCHAR(255) BINARY');
}); });
}); });
describe('primaryKeys', () => { describe('primaryKeys', () => {
it('determines the correct primaryKeys', function() { it('determines the correct primaryKeys', function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
foo: { type: DataTypes.STRING, primaryKey: true }, foo: { type: DataTypes.STRING, primaryKey: true },
bar: DataTypes.STRING bar: DataTypes.STRING
}); });
......
...@@ -4,7 +4,6 @@ const chai = require('chai'), ...@@ -4,7 +4,6 @@ const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Support = require('../../support'), Support = require('../../support'),
dialect = Support.getTestDialect(), dialect = Support.getTestDialect(),
config = require('../../../config/config'),
DataTypes = require('../../../../lib/data-types'); DataTypes = require('../../../../lib/data-types');
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
...@@ -45,8 +44,8 @@ if (dialect.match(/^postgres/)) { ...@@ -45,8 +44,8 @@ if (dialect.match(/^postgres/)) {
describe('addDAO / getModel', () => { describe('addDAO / getModel', () => {
beforeEach(async function() { beforeEach(async function() {
//prevent periods from occurring in the table name since they are used to delimit (table.column) //prevent periods from occurring in the table name since they are used to delimit (table.column)
this.User = this.sequelize.define(`User${config.rand()}`, { name: DataTypes.STRING }); this.User = this.sequelize.define(`User${Support.rand()}`, { name: DataTypes.STRING });
this.Task = this.sequelize.define(`Task${config.rand()}`, { name: DataTypes.STRING }); this.Task = this.sequelize.define(`Task${Support.rand()}`, { name: DataTypes.STRING });
this.users = null; this.users = null;
this.tasks = null; this.tasks = null;
...@@ -79,12 +78,12 @@ if (dialect.match(/^postgres/)) { ...@@ -79,12 +78,12 @@ if (dialect.match(/^postgres/)) {
describe('removeDAO', () => { describe('removeDAO', () => {
it('should correctly remove associated objects', async function() { it('should correctly remove associated objects', async function() {
const users = [], const users = [],
tasks = []; tasks = [];
//prevent periods from occurring in the table name since they are used to delimit (table.column) //prevent periods from occurring in the table name since they are used to delimit (table.column)
this.User = this.sequelize.define(`User${config.rand()}`, { name: DataTypes.STRING }); this.User = this.sequelize.define(`User${Support.rand()}`, { name: DataTypes.STRING });
this.Task = this.sequelize.define(`Task${config.rand()}`, { name: DataTypes.STRING }); this.Task = this.sequelize.define(`Task${Support.rand()}`, { name: DataTypes.STRING });
this.users = null; this.users = null;
this.tasks = null; this.tasks = null;
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
const chai = require('chai'), const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Sequelize = require('../../index'), Sequelize = require('../../index'),
Support = require('./support'), Support = require('./support');
config = require('../config/config');
describe(Support.getTestDialectTeaser('InstanceValidator'), () => { describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
describe('#update', () => { describe('#update', () => {
...@@ -370,7 +369,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -370,7 +369,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
}); });
it('correctly validates using custom validation methods', async function() { it('correctly validates using custom validation methods', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
validate: { validate: {
...@@ -397,7 +396,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -397,7 +396,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
}); });
it('supports promises with custom validation methods', async function() { it('supports promises with custom validation methods', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
validate: { validate: {
...@@ -420,7 +419,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -420,7 +419,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
}); });
it('skips other validations if allowNull is true and the value is null', async function() { it('skips other validations if allowNull is true and the value is null', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
age: { age: {
type: Sequelize.INTEGER, type: Sequelize.INTEGER,
allowNull: true, allowNull: true,
...@@ -439,7 +438,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -439,7 +438,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
}); });
it('validates a model with custom model-wide validation methods', async function() { it('validates a model with custom model-wide validation methods', async function() {
const Foo = this.sequelize.define(`Foo${config.rand()}`, { const Foo = this.sequelize.define(`Foo${Support.rand()}`, {
field1: { field1: {
type: Sequelize.INTEGER, type: Sequelize.INTEGER,
allowNull: true allowNull: true
...@@ -472,7 +471,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -472,7 +471,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
}); });
it('validates model with a validator whose arg is an Array successfully twice in a row', async function() { it('validates model with a validator whose arg is an Array successfully twice in a row', async function() {
const Foo = this.sequelize.define(`Foo${config.rand()}`, { const Foo = this.sequelize.define(`Foo${Support.rand()}`, {
bar: { bar: {
type: Sequelize.STRING, type: Sequelize.STRING,
validate: { validate: {
...@@ -488,7 +487,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -488,7 +487,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('validates enums', async function() { it('validates enums', async function() {
const values = ['value1', 'value2']; const values = ['value1', 'value2'];
const Bar = this.sequelize.define(`Bar${config.rand()}`, { const Bar = this.sequelize.define(`Bar${Support.rand()}`, {
field: { field: {
type: Sequelize.ENUM, type: Sequelize.ENUM,
values, values,
...@@ -508,7 +507,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -508,7 +507,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('skips validations for the given fields', async function() { it('skips validations for the given fields', async function() {
const values = ['value1', 'value2']; const values = ['value1', 'value2'];
const Bar = this.sequelize.define(`Bar${config.rand()}`, { const Bar = this.sequelize.define(`Bar${Support.rand()}`, {
field: { field: {
type: Sequelize.ENUM, type: Sequelize.ENUM,
values, values,
...@@ -526,7 +525,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -526,7 +525,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('skips validations for fields with value that is SequelizeMethod', async function() { it('skips validations for fields with value that is SequelizeMethod', async function() {
const values = ['value1', 'value2']; const values = ['value1', 'value2'];
const Bar = this.sequelize.define(`Bar${config.rand()}`, { const Bar = this.sequelize.define(`Bar${Support.rand()}`, {
field: { field: {
type: Sequelize.ENUM, type: Sequelize.ENUM,
values, values,
......
...@@ -5,7 +5,6 @@ const chai = require('chai'), ...@@ -5,7 +5,6 @@ const chai = require('chai'),
Sequelize = require('../../../index'), Sequelize = require('../../../index'),
Support = require('../support'), Support = require('../support'),
DataTypes = require('../../../lib/data-types'), DataTypes = require('../../../lib/data-types'),
config = require('../../config/config'),
sinon = require('sinon'), sinon = require('sinon'),
current = Support.sequelize; current = Support.sequelize;
...@@ -131,7 +130,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -131,7 +130,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
describe('hooks', () => { describe('hooks', () => {
it('should update attributes added in hooks when default fields are used', async function() { it('should update attributes added in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -161,7 +160,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -161,7 +160,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should update attributes changed in hooks when default fields are used', async function() { it('should update attributes changed in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -192,7 +191,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -192,7 +191,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should validate attributes added in hooks when default fields are used', async function() { it('should validate attributes added in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: { email: {
...@@ -224,7 +223,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -224,7 +223,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should validate attributes changed in hooks when default fields are used', async function() { it('should validate attributes changed in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: { email: {
...@@ -366,7 +365,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -366,7 +365,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should not throw ER_EMPTY_QUERY if changed only virtual fields', async function() { it('should not throw ER_EMPTY_QUERY if changed only virtual fields', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: { bio: {
type: DataTypes.VIRTUAL, type: DataTypes.VIRTUAL,
......
...@@ -6,7 +6,6 @@ const chai = require('chai'), ...@@ -6,7 +6,6 @@ const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Support = require('../support'), Support = require('../support'),
DataTypes = require('../../../lib/data-types'), DataTypes = require('../../../lib/data-types'),
config = require('../../config/config'),
current = Support.sequelize; current = Support.sequelize;
describe(Support.getTestDialectTeaser('Instance'), () => { describe(Support.getTestDialectTeaser('Instance'), () => {
...@@ -79,7 +78,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -79,7 +78,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
} }
it('should update fields that are not specified on create', async function() { it('should update fields that are not specified on create', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -102,7 +101,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -102,7 +101,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should succeed in updating when values are unchanged (without timestamps)', async function() { it('should succeed in updating when values are unchanged (without timestamps)', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -130,7 +129,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -130,7 +129,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should update timestamps with milliseconds', async function() { it('should update timestamps with milliseconds', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING, email: DataTypes.STRING,
...@@ -184,7 +183,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -184,7 +183,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
describe('hooks', () => { describe('hooks', () => {
it('should update attributes added in hooks when default fields are used', async function() { it('should update attributes added in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -214,7 +213,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -214,7 +213,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should update attributes changed in hooks when default fields are used', async function() { it('should update attributes changed in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -245,7 +244,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -245,7 +244,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should validate attributes added in hooks when default fields are used', async function() { it('should validate attributes added in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: { email: {
...@@ -277,7 +276,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -277,7 +276,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should validate attributes changed in hooks when default fields are used', async function() { it('should validate attributes changed in hooks when default fields are used', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: { email: {
...@@ -311,7 +310,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -311,7 +310,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('should not set attributes that are not specified by fields', async function() { it('should not set attributes that are not specified by fields', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
email: DataTypes.STRING email: DataTypes.STRING
...@@ -358,7 +357,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => { ...@@ -358,7 +357,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
}); });
it('doesn\'t update primary keys or timestamps', async function() { it('doesn\'t update primary keys or timestamps', async function() {
const User = this.sequelize.define(`User${ config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
name: DataTypes.STRING, name: DataTypes.STRING,
bio: DataTypes.TEXT, bio: DataTypes.TEXT,
identifier: { type: DataTypes.STRING, primaryKey: true } identifier: { type: DataTypes.STRING, primaryKey: true }
......
...@@ -8,7 +8,6 @@ const chai = require('chai'), ...@@ -8,7 +8,6 @@ const chai = require('chai'),
Op = Sequelize.Op, Op = Sequelize.Op,
DataTypes = require('../../../lib/data-types'), DataTypes = require('../../../lib/data-types'),
dialect = Support.getTestDialect(), dialect = Support.getTestDialect(),
config = require('../../config/config'),
_ = require('lodash'), _ = require('lodash'),
moment = require('moment'), moment = require('moment'),
current = Support.sequelize, current = Support.sequelize,
...@@ -1372,7 +1371,7 @@ describe(Support.getTestDialectTeaser('Model'), () => { ...@@ -1372,7 +1371,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
}); });
it('should allow us to find IDs using capital letters', async function() { it('should allow us to find IDs using capital letters', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
ID: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true }, ID: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true },
Login: { type: Sequelize.STRING } Login: { type: Sequelize.STRING }
}); });
......
...@@ -7,7 +7,6 @@ const chai = require('chai'), ...@@ -7,7 +7,6 @@ const chai = require('chai'),
Support = require('../support'), Support = require('../support'),
dialect = Support.getTestDialect(), dialect = Support.getTestDialect(),
DataTypes = require('../../../lib/data-types'), DataTypes = require('../../../lib/data-types'),
config = require('../../config/config'),
current = Support.sequelize; current = Support.sequelize;
describe(Support.getTestDialectTeaser('Model'), () => { describe(Support.getTestDialectTeaser('Model'), () => {
...@@ -248,7 +247,7 @@ describe(Support.getTestDialectTeaser('Model'), () => { ...@@ -248,7 +247,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
}); });
it('should allow us to find IDs using capital letters', async function() { it('should allow us to find IDs using capital letters', async function() {
const User = this.sequelize.define(`User${config.rand()}`, { const User = this.sequelize.define(`User${Support.rand()}`, {
ID: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true }, ID: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true },
Login: { type: Sequelize.STRING } Login: { type: Sequelize.STRING }
}); });
......
...@@ -362,7 +362,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -362,7 +362,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
describe('truncate', () => { describe('truncate', () => {
it('truncates all models', async function() { it('truncates all models', async function() {
const Project = this.sequelize.define(`project${config.rand()}`, { const Project = this.sequelize.define(`project${Support.rand()}`, {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
primaryKey: true, primaryKey: true,
...@@ -385,8 +385,8 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -385,8 +385,8 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
describe('sync', () => { describe('sync', () => {
it('synchronizes all models', async function() { it('synchronizes all models', async function() {
const Project = this.sequelize.define(`project${config.rand()}`, { title: DataTypes.STRING }); const Project = this.sequelize.define(`project${Support.rand()}`, { title: DataTypes.STRING });
const Task = this.sequelize.define(`task${config.rand()}`, { title: DataTypes.STRING }); const Task = this.sequelize.define(`task${Support.rand()}`, { title: DataTypes.STRING });
await Project.sync({ force: true }); await Project.sync({ force: true });
await Task.sync({ force: true }); await Task.sync({ force: true });
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
const chai = require('chai'), const chai = require('chai'),
expect = chai.expect, expect = chai.expect,
Support = require('../support'), Support = require('../support'),
Sequelize = require('../../../index'), Sequelize = require('../../../index');
config = require('../../config/config')
;
if (!Support.sequelize.dialect.supports.deferrableConstraints) { if (!Support.sequelize.dialect.supports.deferrableConstraints) {
return; return;
...@@ -19,9 +17,9 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -19,9 +17,9 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
this.run = async function(deferrable, options) { this.run = async function(deferrable, options) {
options = options || {}; options = options || {};
const taskTableName = options.taskTableName || `tasks_${config.rand()}`; const taskTableName = options.taskTableName || `tasks_${Support.rand()}`;
const transactionOptions = { deferrable: Sequelize.Deferrable.SET_DEFERRED, ...options }; const transactionOptions = { deferrable: Sequelize.Deferrable.SET_DEFERRED, ...options };
const userTableName = `users_${config.rand()}`; const userTableName = `users_${Support.rand()}`;
const { Task, User } = await defineModels({ sequelize: this.sequelize, userTableName, deferrable, taskTableName }); const { Task, User } = await defineModels({ sequelize: this.sequelize, userTableName, deferrable, taskTableName });
...@@ -58,7 +56,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -58,7 +56,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
}); });
it('allows the violation of the foreign key constraint if the transaction deferres only the foreign key constraint', async function() { it('allows the violation of the foreign key constraint if the transaction deferres only the foreign key constraint', async function() {
const taskTableName = `tasks_${config.rand()}`; const taskTableName = `tasks_${Support.rand()}`;
const task = await this const task = await this
.run(Sequelize.Deferrable.INITIALLY_IMMEDIATE, { .run(Sequelize.Deferrable.INITIALLY_IMMEDIATE, {
......
...@@ -240,6 +240,10 @@ const Support = { ...@@ -240,6 +240,10 @@ const Support = {
} }
}, },
rand() {
return Math.floor(Math.random() * 10e5);
},
isDeepEqualToOneOf(actual, expectedOptions) { isDeepEqualToOneOf(actual, expectedOptions) {
return expectedOptions.some(expected => isDeepStrictEqual(actual, expected)); return expectedOptions.some(expected => isDeepStrictEqual(actual, expected));
} }
......
#!/usr/bin/env node #!/usr/bin/env node
'use strict';
if (!process.env.DIALECT) { if (!process.env.DIALECT) {
throw new Error('Environment variable DIALECT is undefined'); throw new Error('Environment variable DIALECT is undefined');
...@@ -8,4 +9,4 @@ const DIALECT = process.env.DIALECT; ...@@ -8,4 +9,4 @@ const DIALECT = process.env.DIALECT;
const header = '#'.repeat(DIALECT.length + 22); const header = '#'.repeat(DIALECT.length + 22);
const message = `${header}\n# Running tests for ${DIALECT} #\n${header}`; const message = `${header}\n# Running tests for ${DIALECT} #\n${header}`;
console.log(message); console.log(message);
\ No newline at end of file
...@@ -6,8 +6,7 @@ const chai = require('chai'), ...@@ -6,8 +6,7 @@ const chai = require('chai'),
Sequelize = require('../../../index'), Sequelize = require('../../../index'),
Op = Sequelize.Op, Op = Sequelize.Op,
Support = require('../support'), Support = require('../support'),
current = Support.sequelize, current = Support.sequelize;
config = require('../../config/config');
describe(Support.getTestDialectTeaser('InstanceValidator'), () => { describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
...@@ -188,7 +187,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -188,7 +187,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
validations[validator] = validatorDetails.spec || {}; validations[validator] = validatorDetails.spec || {};
validations[validator].msg = message; validations[validator].msg = message;
const UserFail = this.sequelize.define(`User${config.rand()}`, { const UserFail = this.sequelize.define(`User${Support.rand()}`, {
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
validate: validations validate: validations
...@@ -219,7 +218,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => { ...@@ -219,7 +218,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
validations[validator] = true; validations[validator] = true;
} }
const UserSuccess = this.sequelize.define(`User${config.rand()}`, { const UserSuccess = this.sequelize.define(`User${Support.rand()}`, {
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
validate: validations validate: validations
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!