1 | GREP ?=.
|
2 | #check if xvfb is running
|
3 | XVFB_RUNNING = $(shell pgrep "Xvfb" > /dev/null; echo $$?)
|
4 | #set the circle project name if not set
|
5 | CIRCLE_PROJECT_REPONAME ?= 1
|
6 | #set headless if not set
|
7 | HEADLESS ?= 1
|
8 |
|
9 | test: node_modules lint
|
10 | @rm -rf /tmp/nightmare
|
11 | #if this build is not on circle, is not headless, and xvfb is not already running,
|
12 | #run mocha as usual
|
13 | #otherwise, run mocha under the xvfb wrapper
|
14 | ifeq ($(CIRCLE_PROJECT_REPONAME)$(HEADLESS)$(XVFB_RUNNING), 111)
|
15 | @node_modules/.bin/mocha --grep "$(GREP)"
|
16 | else
|
17 | @./test/bb-xvfb node_modules/.bin/mocha --grep "$(GREP)"
|
18 | endif
|
19 |
|
20 | lint: node_modules
|
21 | @./node_modules/.bin/eslint --fix lib/*.js test/*.js
|
22 |
|
23 | node_modules: package.json
|
24 | @npm install
|
25 |
|
26 | .PHONY: test lint
|