Skip to content

Commit 2f4b7c9

Browse files
committed
Add mocha-phantomjs tests
1 parent 9a08a03 commit 2f4b7c9

22 files changed

+17304
-200
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test/node_modules
21
node_modules
32
components
43
npm-debug.log
4+
build

Makefile

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
SRC = $(wildcard src/*.js)
2+
TESTS = $(wildcard test/*.js)
23
BINS = node_modules/.bin
34
DUO = $(BINS)/duo
45
MINIFY = $(BINS)/uglifyjs
6+
BUILD_DIR = build
7+
BUILD = tests.js
8+
PROJECT = amplitude
9+
OUT = $(PROJECT).js
10+
MIN_OUT = $(PROJECT).min.js
11+
MOCHA = $(BINS)/mocha-phantomjs
512

613
#
714
# Default target.
815
#
916

10-
default: amplitude.js
17+
default: test
1118

1219
#
1320
# Clean.
@@ -18,6 +25,15 @@ clean:
1825
@-rm -f amplitude.js amplitude.min.js
1926
@-rm -rf node_modules npm-debug.log
2027

28+
29+
#
30+
# Test.
31+
#
32+
33+
test: build test/browser/index.html
34+
@$(MOCHA) test/browser/index.html
35+
36+
2137
#
2238
# Target for `node_modules` folder.
2339
#
@@ -26,9 +42,21 @@ node_modules: package.json
2642
@npm install
2743

2844
#
29-
# Target for `analytics.js` file.
45+
# Target for `amplitude.js` file.
3046
#
3147

32-
amplitude.js: node_modules $(SRC)
33-
@$(DUO) --standalone amplitude src/index.js > amplitude.js
34-
@$(MINIFY) amplitude.js --output amplitude.min.js
48+
$(OUT): node_modules $(SRC)
49+
@$(DUO) --standalone amplitude src/index.js > $(OUT)
50+
@$(MINIFY) $(OUT) --output $(MIN_OUT)
51+
52+
53+
#
54+
# Target for `tests-build.js` file.
55+
#
56+
57+
build: $(TESTS) $(OUT)
58+
@-mkdir -p build
59+
@$(DUO) --development test/tests.js > build/tests.js
60+
61+
.PHONY: clean
62+
.PHONY: test

0 commit comments

Comments
 (0)