UNPKG

712 BPlain TextView Raw
1GREP ?=.
2#check if xvfb is running
3XVFB_RUNNING = $(shell pgrep "Xvfb" > /dev/null; echo $$?)
4#set the circle project name if not set
5CIRCLE_PROJECT_REPONAME ?= 1
6#set headless if not set
7HEADLESS ?= 1
8
9test: 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
14ifeq ($(CIRCLE_PROJECT_REPONAME)$(HEADLESS)$(XVFB_RUNNING), 111)
15 @node_modules/.bin/mocha --grep "$(GREP)"
16else
17 @./test/bb-xvfb node_modules/.bin/mocha --grep "$(GREP)"
18endif
19
20lint: node_modules
21 @./node_modules/.bin/eslint --fix lib/*.js test/*.js
22
23node_modules: package.json
24 @npm install
25
26.PHONY: test lint