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

Commit 96ab36d4 by Jan Aagaard Meier

Merge pull request #5368 from sushantdhiman/gulp-build

NPM Script Build
2 parents 99acdd02 8be68aca
...@@ -29,7 +29,7 @@ before_script: ...@@ -29,7 +29,7 @@ before_script:
- "psql sequelize_test -c 'create extension postgis;' -U postgres" - "psql sequelize_test -c 'create extension postgis;' -U postgres"
script: script:
- "make test" - "npm test"
matrix: matrix:
fast_finish: true fast_finish: true
......
...@@ -124,10 +124,10 @@ All tests are located in the `test` folder (which contains the ...@@ -124,10 +124,10 @@ All tests are located in the `test` folder (which contains the
lovely [Mocha](http://visionmedia.github.io/mocha/) tests). lovely [Mocha](http://visionmedia.github.io/mocha/) tests).
```console ```console
$ make all || mysql || sqlite || pgsql || postgres || mariadb || postgres-native $ npm run all || mysql || sqlite || pgsql || postgres || mariadb || 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 make test $ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
``` ```
#### 4a. Check the documentation #### 4a. Check the documentation
......
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
# Integration tests
test-integration:
@if [ "$$GREP" ]; then \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
else \
$(MOCHA) --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --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-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
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
# Coverage
cover:
rm -rf coverage \
make teaser && COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd $(TESTS); \
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
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=ce835a510bbf423a5ab5400a9bdcc2ec2d189d840b31657c6ee7cb9916b161d6 codeclimate < coverage/lcov.info
# test aliases
pgsql: postgres
postgresn: postgres-native
# test all the dialects \o/
all: sqlite mysql postgres postgres-native mariadb
all-cover: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover mssql-cover merge-coverage
codeclimate: all-cover codeclimate-send
.PHONY: sqlite mysql postgres pgsql postgres-native postgresn all test
...@@ -87,11 +87,49 @@ ...@@ -87,11 +87,49 @@
], ],
"main": "index", "main": "index",
"scripts": { "scripts": {
"test": "make all", "test": "if [ $COVERAGE ]; then npm run codeclimate; else npm run jshint && npm run teaser && npm run test-unit && npm run test-integration; fi",
"test-docker": "docker-compose run sequelize /bin/sh -c \"make all\"", "test-docker": "docker-compose run sequelize /bin/sh -c \"npm run test-all\"",
"test-docker-unit": "docker-compose run sequelize /bin/sh -c \"make test-unit-all\"", "test-docker-unit": "docker-compose run sequelize /bin/sh -c \"npm run test-unit-all\"",
"build-docker": "docker-compose build", "build-docker": "docker-compose build",
"docs": "node docs/docs-generator.js" "docs": "node docs/docs-generator.js",
"jshint": "./node_modules/.bin/jshint lib test",
"teaser": "echo ''; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\"; echo '# Running tests for '$DIALECT' #'; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\";echo '';",
"test-unit": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec 'test/unit/**/*.js'",
"test-unit-mysql":"DIALECT=mysql npm run test-unit",
"test-unit-postgres":"DIALECT=postgres npm run test-unit",
"test-unit-postgres-native":"DIALECT=postgres-native npm run test-unit",
"test-unit-mariadb":"DIALECT=mariadb npm run test-unit",
"test-unit-sqlite":"DIALECT=sqlite npm run test-unit",
"test-unit-mssql":"DIALECT=mssql npm run test-unit",
"test-unit-all":"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 && npm run test-unit-mariadb",
"test-integration": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec --grep ''$GREP'' 'test/integration/**/*.test.js'",
"test-integration-mysql":"DIALECT=mysql npm run test-integration",
"test-integration-postgres":"DIALECT=postgres npm run test-integration",
"test-integration-postgres-native":"DIALECT=postgres-native npm run test-integration",
"test-integration-mariadb":"DIALECT=mariadb npm run test-integration",
"test-integration-sqlite":"DIALECT=sqlite npm run test-integration",
"test-integration-mssql":"DIALECT=mssql npm run test-integration",
"test-integration-all":"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 && npm run test-integration-mariadb",
"test-mysql": "DIALECT=mysql npm test",
"test-sqlite": "DIALECT=sqlite npm test",
"test-postgres": "DIALECT=postgres npm test",
"test-pgsql": "npm run test-postgres",
"test-postgres-native": "DIALECT=postgres-native npm test",
"test-postgresn": "npm run test-postgres-native",
"test-mariadb": "DIALECT=mariadb npm test",
"test-mssql": "DIALECT=mssql npm test",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mariadb && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/integration/**/*.test.js'",
"cover-mysql": "DIALECT=mysql npm run cover && mv coverage coverage-mysql",
"cover-sqlite": "DIALECT=sqlite npm run cover && mv coverage coverage-sqlite",
"cover-postgres": "DIALECT=postgres npm run cover && mv coverage coverage-postgres",
"cover-postgres-native": "DIALECT=postgres-native npm run cover && mv coverage coverage-postgres-native",
"cover-mariadb": "DIALECT=mariadb npm run cover && mv coverage coverage-mariadb",
"cover-mssql": "DIALECT=mssql npm run cover && mv coverage coverage-mssql",
"cover-all": "npm run cover-mysql && npm run cover-postgres && npm run cover-postgres-native && npm run cover-mssql && npm run cover-sqlite && npm run cover-mariadb && npm run merge-coverage",
"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=ce835a510bbf423a5ab5400a9bdcc2ec2d189d840b31657c6ee7cb9916b161d6 codeclimate-test-reporter < coverage/lcov.info",
"codeclimate": "npm run cover-all && npm run codeclimate-send"
}, },
"engines": { "engines": {
"node": ">=0.6.21" "node": ">=0.6.21"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!