1 | RABBITMQ_SRC_VERSION=v3.12.13
|
2 | JSON=amqp-rabbitmq-0.9.1.json
|
3 | AMQP_JSON=https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/$(RABBITMQ_SRC_VERSION)/deps/rabbitmq_codegen/$(JSON)
|
4 |
|
5 | NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0'
|
6 |
|
7 | MOCHA=./node_modules/.bin/mocha
|
8 | _MOCHA=./node_modules/.bin/_mocha
|
9 | UGLIFY=./node_modules/.bin/uglifyjs
|
10 | NYC=./node_modules/.bin/nyc
|
11 |
|
12 | .PHONY: test test-all-nodejs all clean coverage
|
13 |
|
14 | all: lib/defs.js
|
15 |
|
16 | clean:
|
17 | rm lib/defs.js bin/amqp-rabbitmq-0.9.1.json
|
18 | rm -rf ./coverage
|
19 |
|
20 | lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
|
21 | (cd bin; node ./generate-defs.js > ../lib/defs.js)
|
22 | $(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
|
23 | -c 'sequences=false' --comments \
|
24 | -b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
|
25 |
|
26 | test: lib/defs.js
|
27 | $(MOCHA) --check-leaks -u tdd --exit test/
|
28 |
|
29 | test-all-nodejs: lib/defs.js
|
30 | for v in $(NODEJS_VERSIONS); \
|
31 | do echo "-- Node version $$v --"; \
|
32 | nave use $$v $(MOCHA) -u tdd --exit -R progress test; \
|
33 | done
|
34 |
|
35 | coverage: $(NYC) lib/defs.js
|
36 | $(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/
|
37 | @echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html"
|
38 |
|
39 | bin/amqp-rabbitmq-0.9.1.json:
|
40 | curl -L $(AMQP_JSON) > $@
|
41 |
|
42 | $(ISTANBUL):
|
43 | npm install
|
44 |
|
45 | $(UGLIFY):
|
46 | npm install
|