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

You need to sign in or sign up before continuing.
Commit f980f1e2 by Mick Hansen

add seperate makefile targets for unit and integration tests

1 parent a54089c0
REPORTER ?= spec
TESTS = $(shell find ./test/* -name "*.test.js")
TESTS = $(shell find ./test/integration/* -name "*.test.js")
DIALECT ?= mysql
# test commands
......@@ -15,6 +15,7 @@ ifeq (true,$(COVERAGE))
test: codeclimate
else
test:
make jshint && make teaser && make test-unit && make test-integration
@if [ "$$GREP" ]; then \
make jshint && make teaser && ./node_modules/mocha/bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 10000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
else \
......@@ -22,16 +23,52 @@ test:
fi
endif
test-only:
# Unit tests
test-unit:
./node_modules/mocha/bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 10000 --reporter $(REPORTER) ./test/unit/**/*.js
test-unit-all: test-unit-sqlite test-unit-mysql test-unit-postgres test-unit-postgres-native test-unit-mariadb
test-unit-mariadb:
@DIALECT=mariadb make test-unit
test-unit-sqlite:
@DIALECT=sqlite make test-unit
test-unit-mysql:
@DIALECT=mysql make test-unit
test-unit-mssql:
@DIALECT=mssql make test-unit
test-unit-postgres:
@DIALECT=postgres make test-unit
test-unit-postgres-native:
@DIALECT=postgres-native make test-unit
# Integration tests
test-integration:
@if [ "$$GREP" ]; then \
./node_modules/mocha/bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 10000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
else \
./node_modules/mocha/bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 10000 --reporter $(REPORTER) $(TESTS); \
fi
test-integration-all: test-integration-sqlite test-integration-mysql test-integration-postgres test-integration-postgres-native test-integration-mariadb
test-integration-mariadb:
@DIALECT=mariadb make test-integration
test-integration-sqlite:
@DIALECT=sqlite make test-integration
test-integration-mysql:
@DIALECT=mysql make test-integration
test-integration-mssql:
@DIALECT=mssql make test-integration
test-integration-postgres:
@DIALECT=postgres make test-integration
test-integration-postgres-native:
@DIALECT=postgres-native make test-integration
jshint:
./node_modules/.bin/jshint lib test
cover:
rm -rf coverage \
make teaser && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 10000 --ui tdd $(TESTS); \
mariadb:
@DIALECT=mariadb make test
sqlite:
......@@ -45,6 +82,11 @@ postgres:
postgres-native:
@DIALECT=postgres-native make test
# Coverage
cover:
rm -rf coverage \
make teaser && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 10000 --ui tdd $(TESTS); \
mariadb-cover:
rm -rf coverage
@DIALECT=mariadb make cover
......
......@@ -14,7 +14,8 @@ var MariaDialect = function(sequelize) {
options: sequelize.options,
_dialect: this,
sequelize: sequelize
});};
});
};
MariaDialect.prototype = MySQL.prototype;
MariaDialect.prototype.Query = Query;
......
......@@ -10,6 +10,11 @@ var MysqlDialect = function(sequelize) {
this.sequelize = sequelize;
this.connectionManager = new ConnectionManager(this, sequelize);
this.connectionManager.initPools();
this.QueryGenerator = _.extend({}, QueryGenerator, {
options: sequelize.options,
_dialect: this,
sequelize: sequelize
});
};
MysqlDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.supports), {
......
......@@ -9,7 +9,7 @@ var Support = require(__dirname + '/../support')
// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation
suite('SQL', function() {
suite(Support.getTestDialectTeaser('SQL'), function() {
suite('whereQuery', function () {
var testsql = function (params, options, expectation) {
if (expectation === undefined) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!