-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
157 lines (134 loc) · 4.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
REPORTER ?= spec
TESTS = $(shell find ./test/integration/* -name "*.test.js")
DIALECT ?= mysql
JSHINT ?= ./node_modules/.bin/jshint
MOCHA ?= ./node_modules/.bin/mocha
# test commands
teaser:
@echo "" && \
node -pe "Array(20 + '$(DIALECT)'.length + 3).join('#')" && \
echo '# Running tests for $(DIALECT) #' && \
node -pe "Array(20 + '$(DIALECT)'.length + 3).join('#')" && \
echo ''
ifeq (true,$(COVERAGE))
test: codeclimate
else
test:
make jshint && make teaser && make test-unit && make test-integration;
endif
# Unit tests
test-unit:
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter $(REPORTER) ./test/unit/*.js ./test/unit/**/*.js
test-unit-all: test-unit-sqlite test-unit-mysql test-unit-postgres test-unit-postgres-native test-unit-mariadb test-unit-mssql
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
test-unit-oracle:
@DIALECT=oracle make test-unit
# Integration tests
test-integration:
@if [ "$$GREP" ]; then \
if [ "DIALECT${DIALECT}" = "DIALECToracle" ]; then \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter $(REPORTER) -g "$$GREP" ./test/oracle_integration_tmp/example.js; \
else \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
fi \
else \
if [ "DIALECT${DIALECT}" = "DIALECToracle" ]; then \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter $(REPORTER) ./test/oracle_integration_tmp/example.js; \
else \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter $(REPORTER) $(TESTS); \
fi \
fi
test-integration-all: test-integration-sqlite test-integration-mysql test-integration-postgres test-integration-postgres-native test-integration-mariadb test-integration-mssql
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
test-integration-oracle:
@DIALECT=oracle make test-integration
jshint:
$(JSHINT) lib test
mariadb:
@DIALECT=mariadb make test
sqlite:
@DIALECT=sqlite make test
mysql:
@DIALECT=mysql make test
mssql:
@DIALECT=mssql make test
postgres:
@DIALECT=postgres make test
postgres-native:
@DIALECT=postgres-native make test
oracle:
@DIALECT=oracle make test
# Coverage
cover:
if [ "DIALECT${DIALECT}" = "DIALECToracle" ]; then \
rm -rf coverage \
make teaser && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 15000 --ui tdd ./test/oracle_integration_tmp/example.js; \
else \
rm -rf coverage \
make teaser && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 15000 --ui tdd $(TESTS); \
fi
mssql-cover:
rm -rf coverage
@DIALECT=mssql make cover
mv coverage coverage-mssql
mariadb-cover:
rm -rf coverage
@DIALECT=mariadb make cover
mv coverage coverage-mariadb
sqlite-cover:
rm -rf coverage
@DIALECT=sqlite make cover
mv coverage coverage-sqlite
mysql-cover:
rm -rf coverage
@DIALECT=mysql make cover
mv coverage coverage-mysql
postgres-cover:
rm -rf coverage
@DIALECT=postgres make cover
mv coverage coverage-postgres
postgres-native-cover:
rm -rf coverage
@DIALECT=postgres-native make cover
mv coverage coverage-postgresnative
oracle-cover:
rm -rf coverage
@DIALECT=oracle make cover
mv coverage coverage-oracle
merge-coverage:
rm -rf coverage
mkdir coverage
./node_modules/.bin/lcov-result-merger 'coverage-*/lcov.info' 'coverage/lcov.info'
codeclimate-send:
npm install -g codeclimate-test-reporter
CODECLIMATE_REPO_TOKEN=b3a6d1113ecc9a912056cc0adc1490d3b8990069fb00f27dba6eefe61cd637c3 codeclimate < coverage/lcov.info
# test aliases
pgsql: postgres
postgresn: postgres-native
# test all the dialects \o/
all: sqlite mysql postgres postgres-native mariadb oracle
all-cover: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover mssql-cover oracle-cover merge-coverage
codeclimate: all-cover codeclimate-send
.PHONY: sqlite mysql postgres pgsql postgres-native postgresn all test oracle