-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
125 lines (93 loc) · 3.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
REPORTER = dot
TARGETS ?= unexpected.js unexpected.js.map unexpected.esm.js unexpected.esm.js.map
.PHONY: unexpected.js unexpected.esm.js
.SECONDARY: unexpected.js.map unexpected.esm.js.map
TEST_SOURCES_MARKDOWN = $(shell find documentation -name '*.md')
lint:
npm run lint
.PHONY: lint
build/lib: lib/*
mkdir -p ./build
./node_modules/.bin/buble -o build/lib lib
build/test: $(shell find test -type f)
mkdir -p ./build
./node_modules/.bin/buble -o build/test test
cp ./.mocharc.json ./build/test/.mocharc.json
sed -i -e 's#./test#./build/test#g' ./build/test/.mocharc.json
build/externaltests: externaltests/*
./node_modules/.bin/buble -o build/externaltests externaltests
cp ./externaltests/*.json ./build/externaltests/
build: build/lib build/test build/externaltests
build/tests.esm.js: build/test
./node_modules/.bin/rollup --config rollup.tests.js > build/tests.esm.js
unexpected.js unexpected.js.map: build
./node_modules/.bin/rollup --config rollup.config.js --sourcemap --format umd --name weknowhow.expect -o unexpected.js build/lib/index.js
unexpected.esm.js unexpected.esm.js.map: build
ESM_BUILD=yes ./node_modules/.bin/rollup --config rollup.config.js --sourcemap --format esm --name weknowhow.expect -o unexpected.esm.js build/lib/index.js
test-jasmine:
./node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/support/jasmine.json
MOCHA_CONFIG = .mocharc.json
TEST_SOURCES = $(shell find test -name '*.spec.js')
.PHONY: test-jest
test-jest:
./node_modules/.bin/jest
.PHONY: test
test:
@./node_modules/.bin/mocha --config $(MOCHA_CONFIG) $(TEST_SOURCES)
make test-docs
.PHONY: test-docs
test-docs:
@./node_modules/.bin/evaldown --comment-marker unexpected-markdown --require ./bootstrap-unexpected-markdown.js --validate --reporter spec ./documentation
nyc-includes:
NYC_INCLUDES='lib/**'
.PHONY: coverage
coverage: nyc-includes
@./node_modules/.bin/nyc --include $(NYC_INCLUDES) --reporter=lcov --reporter=text --all -- node_modules/.bin/mocha --config $(MOCHA_CONFIG) $(TEST_SOURCES)
@echo google-chrome coverage/lcov-report/index.html
.PHONY: test-browser
test-browser: ${TARGETS}
@./node_modules/.bin/karma start --browsers=Chrome --debug
.PHONY: test-chrome-headless
test-chrome-headless: ${TARGETS}
@./node_modules/.bin/karma start --browsers=ChromeHeadlessNoSandbox --single-run
.PHONY: test-browserstack
test-browserstack-%: ${TARGETS}
@./node_modules/.bin/karma start --browsers=$* --single-run
.PHONY: test-plugins
test-plugins: ${TARGETS}
./node_modules/.bin/fugl --config .fugl.json --reporter html --ci
.PHONY: test-deno
test-deno: ${TARGETS} build/tests.esm.js
if [ ! -f ~/.deno/bin/deno ]; then \
curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.30.3; \
fi;
~/.deno/bin/deno run --location http://localhost test-deno/deno-test.js
.PHONY: travis-coverage
travis-coverage: clean coverage
-<coverage/lcov.info ./node_modules/coveralls/bin/coveralls.js
.PHONY: travis
travis: test
.PHONY: git-dirty-check
git-dirty-check:
ifneq ($(shell git describe --always --dirty | grep -- -dirty),)
$(error Working tree is dirty, please commit or stash your changes, then try again)
endif
.PHONY: deploy-site
deploy-site: site-build
./node_modules/.bin/gh-pages -d site-build -r git@github.com:unexpectedjs/unexpectedjs.github.io.git -b master
.PHONY: release-%
release-%: git-dirty-check lint ${TARGETS} test-chrome-headless test-jasmine test-jest check-site-links deploy-site
IS_MAKE_RELEASE=yes npm version $*
@echo $* release ready to be publised to NPM
@echo Remember to push master and tags
.PHONY: clean
clean:
-rm -fr ${TARGETS} coverage build
.PHONY: site-build
site-build:
npm run generate-site
check-site-links: site-build
./node_modules/.bin/hyperlink -ri --canonicalroot https://unexpected.js.org --skip content-type-mismatch --skip unexpected.js.org/unexpected- site-build/index.html | ./node_modules/.bin/tap-spot
.PHONY: update-examples
update-examples:
npm run update-examples