2014-10-23 10:52:21 -04:00
|
|
|
SHELL := /bin/sh
|
|
|
|
|
|
|
|
connectionString=postgres://
|
|
|
|
|
|
|
|
params := $(connectionString)
|
|
|
|
|
|
|
|
node-command := xargs -n 1 -I file node file $(params)
|
|
|
|
|
|
|
|
.PHONY : test test-connection test-integration bench test-native \
|
2015-01-28 15:33:44 -05:00
|
|
|
jshint publish test-missing-native update-npm
|
2014-10-23 10:52:21 -04:00
|
|
|
|
|
|
|
all:
|
|
|
|
npm install
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "make prepare-test-db [connectionString=postgres://<your connection string>]"
|
|
|
|
@echo "make test-all [connectionString=postgres://<your connection string>]"
|
|
|
|
|
|
|
|
test: test-unit
|
|
|
|
|
2015-01-28 15:33:44 -05:00
|
|
|
test-all: jshint test-missing-native test-unit test-integration test-native test-binary
|
2014-10-23 10:52:21 -04:00
|
|
|
|
|
|
|
|
2015-01-28 15:33:44 -05:00
|
|
|
udpate-npm:
|
|
|
|
@npm i npm --global
|
2014-10-23 10:52:21 -04:00
|
|
|
|
|
|
|
bench:
|
|
|
|
@find benchmark -name "*-bench.js" | $(node-command)
|
|
|
|
|
|
|
|
test-unit:
|
|
|
|
@find test/unit -name "*-tests.js" | $(node-command)
|
|
|
|
|
|
|
|
test-connection:
|
|
|
|
@echo "***Testing connection***"
|
|
|
|
@node script/test-connection.js $(params)
|
|
|
|
|
|
|
|
test-connection-binary:
|
|
|
|
@echo "***Testing binary connection***"
|
|
|
|
@node script/test-connection.js $(params) binary
|
|
|
|
|
2015-01-28 15:33:44 -05:00
|
|
|
test-missing-native:
|
|
|
|
@echo "***Testing optional native install***"
|
|
|
|
@rm -rf node_modules/pg-native
|
|
|
|
@node test/native/missing-native.js
|
|
|
|
@npm install pg-native@1.4.0
|
|
|
|
@node test/native/missing-native.js
|
|
|
|
@rm -rf node_modules/pg-native
|
|
|
|
|
|
|
|
node_modules/pg-native/index.js:
|
|
|
|
@npm i pg-native
|
|
|
|
|
|
|
|
test-native: node_modules/pg-native/index.js
|
2014-10-23 10:52:21 -04:00
|
|
|
@echo "***Testing native bindings***"
|
|
|
|
@find test/native -name "*-tests.js" | $(node-command)
|
|
|
|
@find test/integration -name "*-tests.js" | $(node-command) native
|
|
|
|
|
2015-01-28 15:33:44 -05:00
|
|
|
test-integration: test-connection
|
2014-10-23 10:52:21 -04:00
|
|
|
@echo "***Testing Pure Javascript***"
|
|
|
|
@find test/integration -name "*-tests.js" | $(node-command)
|
|
|
|
|
|
|
|
test-binary: test-connection-binary
|
|
|
|
@echo "***Testing Pure Javascript (binary)***"
|
|
|
|
@find test/integration -name "*-tests.js" | $(node-command) binary
|
|
|
|
|
|
|
|
prepare-test-db:
|
|
|
|
@echo "***Preparing the database for tests***"
|
|
|
|
@find script/create-test-tables.js | $(node-command)
|
|
|
|
|
|
|
|
jshint:
|
|
|
|
@echo "***Starting jshint***"
|
|
|
|
@./node_modules/.bin/jshint lib
|