Skip to content

Commit a7ea2b1

Browse files
committed
Merge pull request #653 from JacksonTian/coverage
Add make coverage command to get test coverage info
2 parents 4f99812 + de00809 commit a7ea2b1

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ node_modules
33
.*.swp
44
.lock-*
55
build
6+
coverage
67

78
builderror.log

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
ALL_TESTS = $(shell find test/ -name '*.test.js')
22
ALL_INTEGRATION = $(shell find test/ -name '*.integration.js')
33

4-
all:
5-
node-gyp configure build
6-
7-
clean:
8-
node-gyp clean
9-
104
run-tests:
115
@./node_modules/.bin/mocha \
126
-t 5000 \
@@ -21,12 +15,23 @@ run-integrationtests:
2115
$(TESTFLAGS) \
2216
$(TESTS)
2317

18+
run-coverage:
19+
@./node_modules/.bin/istanbul cover --report html \
20+
./node_modules/.bin/_mocha -- \
21+
-t 5000 \
22+
-s 6000 \
23+
$(TESTFLAGS) \
24+
$(TESTS)
25+
2426
test:
2527
@$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
2628

2729
integrationtest:
2830
@$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests
2931

32+
coverage:
33+
@$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage
34+
3035
benchmark:
3136
@node bench/sender.benchmark.js
3237
@node bench/parser.benchmark.js
@@ -37,4 +42,4 @@ autobahn:
3742
autobahn-server:
3843
@NODE_PATH=lib node test/autobahn-server.js
3944

40-
.PHONY: test
45+
.PHONY: test coverage

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"benchmark": "0.3.x",
3131
"bufferutil": "1.2.x",
3232
"expect.js": "0.3.x",
33+
"istanbul": "^0.4.1",
3334
"mocha": "2.3.x",
3435
"should": "8.0.x",
3536
"tinycolor": "0.0.x",

0 commit comments

Comments
 (0)