Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit f980f1e2
authored
Jan 25, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add seperate makefile targets for unit and integration tests
1 parent
a54089c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
10 deletions
Makefile
lib/dialects/mariadb/index.js
lib/dialects/mysql/index.js
test/unit/sql/where.test.js
Makefile
View file @
f980f1e
REPORTER
?=
spec
REPORTER
?=
spec
TESTS
=
$(
shell
find ./test/
*
-name
"*.test.js"
)
TESTS
=
$(
shell
find ./test/
integration/
*
-name
"*.test.js"
)
DIALECT
?=
mysql
DIALECT
?=
mysql
# test commands
# test commands
...
@@ -15,6 +15,7 @@ ifeq (true,$(COVERAGE))
...
@@ -15,6 +15,7 @@ ifeq (true,$(COVERAGE))
test
:
codeclimate
test
:
codeclimate
else
else
test
:
test
:
make jshint
&&
make teaser
&&
make
test
-unit
&&
make
test
-integration
@
if
[
"
$$
GREP"
]
;
then
\
@
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)
;
\
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
\
else
\
...
@@ -22,16 +23,52 @@ test:
...
@@ -22,16 +23,52 @@ test:
fi
fi
endif
endif
test-only
:
# Unit tests
./node_modules/mocha/bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 10000 --reporter
$(REPORTER)
$(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
:
jshint
:
./node_modules/.bin/jshint lib
test
./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
:
mariadb
:
@
DIALECT
=
mariadb make
test
@
DIALECT
=
mariadb make
test
sqlite
:
sqlite
:
...
@@ -45,6 +82,11 @@ postgres:
...
@@ -45,6 +82,11 @@ postgres:
postgres-native
:
postgres-native
:
@
DIALECT
=
postgres-native make
test
@
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
:
mariadb-cover
:
rm -rf coverage
rm -rf coverage
@
DIALECT
=
mariadb make cover
@
DIALECT
=
mariadb make cover
...
@@ -91,4 +133,4 @@ all-cover: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb
...
@@ -91,4 +133,4 @@ all-cover: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb
coveralls
:
sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage coveralls-send
coveralls
:
sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage coveralls-send
codeclimate
:
sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage codeclimate-send
codeclimate
:
sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage codeclimate-send
.PHONY
:
sqlite mysql postgres pgsql postgres-native postgresn all test
.PHONY
:
sqlite mysql postgres pgsql postgres-native postgresn all test
\ No newline at end of file
lib/dialects/mariadb/index.js
View file @
f980f1e
...
@@ -14,7 +14,8 @@ var MariaDialect = function(sequelize) {
...
@@ -14,7 +14,8 @@ var MariaDialect = function(sequelize) {
options
:
sequelize
.
options
,
options
:
sequelize
.
options
,
_dialect
:
this
,
_dialect
:
this
,
sequelize
:
sequelize
sequelize
:
sequelize
});};
});
};
MariaDialect
.
prototype
=
MySQL
.
prototype
;
MariaDialect
.
prototype
=
MySQL
.
prototype
;
MariaDialect
.
prototype
.
Query
=
Query
;
MariaDialect
.
prototype
.
Query
=
Query
;
...
...
lib/dialects/mysql/index.js
View file @
f980f1e
...
@@ -10,6 +10,11 @@ var MysqlDialect = function(sequelize) {
...
@@ -10,6 +10,11 @@ var MysqlDialect = function(sequelize) {
this
.
sequelize
=
sequelize
;
this
.
sequelize
=
sequelize
;
this
.
connectionManager
=
new
ConnectionManager
(
this
,
sequelize
);
this
.
connectionManager
=
new
ConnectionManager
(
this
,
sequelize
);
this
.
connectionManager
.
initPools
();
this
.
connectionManager
.
initPools
();
this
.
QueryGenerator
=
_
.
extend
({},
QueryGenerator
,
{
options
:
sequelize
.
options
,
_dialect
:
this
,
sequelize
:
sequelize
});
};
};
MysqlDialect
.
prototype
.
supports
=
_
.
merge
(
_
.
cloneDeep
(
Abstract
.
prototype
.
supports
),
{
MysqlDialect
.
prototype
.
supports
=
_
.
merge
(
_
.
cloneDeep
(
Abstract
.
prototype
.
supports
),
{
...
...
test/unit/sql/where.test.js
View file @
f980f1e
...
@@ -9,7 +9,7 @@ var Support = require(__dirname + '/../support')
...
@@ -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
// 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
()
{
suite
(
'whereQuery'
,
function
()
{
var
testsql
=
function
(
params
,
options
,
expectation
)
{
var
testsql
=
function
(
params
,
options
,
expectation
)
{
if
(
expectation
===
undefined
)
{
if
(
expectation
===
undefined
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment