2011-12-07 06:10:15 +00:00
|
|
|
|
2020-06-09 10:17:41 +00:00
|
|
|
NODE_MAJOR_VERSION := $(firstword $(subst ., ,$(shell node --version)))
|
|
|
|
|
|
|
|
ifeq ($(NODE_MAJOR_VERSION),v8)
|
|
|
|
TESTS = test/*.js
|
|
|
|
else ifeq ($(NODE_MAJOR_VERSION),v10)
|
2011-12-15 10:28:16 +00:00
|
|
|
TESTS = test/*.js
|
2020-06-09 10:17:41 +00:00
|
|
|
else ifeq ($(NODE_MAJOR_VERSION),v12)
|
|
|
|
TESTS = test/*.js
|
|
|
|
else
|
|
|
|
TESTS = test/*.js test/*.mjs
|
|
|
|
endif
|
|
|
|
|
2013-02-03 23:01:06 +00:00
|
|
|
REPORTER = dot
|
2011-12-07 06:10:15 +00:00
|
|
|
|
2013-02-03 23:01:06 +00:00
|
|
|
#
|
|
|
|
# Browser Build
|
2014-01-26 06:35:09 +00:00
|
|
|
#
|
2011-12-07 06:10:15 +00:00
|
|
|
|
2013-09-18 02:13:12 +00:00
|
|
|
all: chai.js
|
|
|
|
|
2015-05-27 13:04:16 +00:00
|
|
|
chai.js: node_modules lib/*
|
2013-09-17 21:22:36 +00:00
|
|
|
@printf "==> [Browser :: build]\n"
|
2015-06-03 22:36:25 +00:00
|
|
|
@./node_modules/.bin/browserify \
|
|
|
|
--bare \
|
|
|
|
--outfile chai.js \
|
|
|
|
--standalone chai \
|
|
|
|
--entry index.js
|
|
|
|
|
|
|
|
#
|
|
|
|
# Release Task
|
|
|
|
#
|
|
|
|
|
|
|
|
define release
|
2017-06-05 17:12:19 +00:00
|
|
|
./node_modules/.bin/bump -y --$(1) package.json lib/chai.js
|
2015-06-03 22:36:25 +00:00
|
|
|
make chai.js
|
2015-06-03 23:19:28 +00:00
|
|
|
git add --force chai.js lib/chai.js package.json bower.json
|
2015-06-03 22:36:25 +00:00
|
|
|
npm ls --depth=-1 --long . --loglevel silent | head -1 | git commit -F-
|
|
|
|
endef
|
|
|
|
|
|
|
|
release-patch:
|
|
|
|
@$(call release,patch)
|
|
|
|
|
|
|
|
release-minor:
|
|
|
|
@$(call release,minor)
|
|
|
|
|
|
|
|
release-major:
|
|
|
|
@$(call release,major)
|
2011-12-07 06:10:15 +00:00
|
|
|
|
2013-09-18 02:13:12 +00:00
|
|
|
#
|
|
|
|
# Node Module
|
|
|
|
#
|
|
|
|
|
|
|
|
node_modules: package.json
|
|
|
|
@npm install
|
|
|
|
|
2013-02-03 19:41:13 +00:00
|
|
|
#
|
|
|
|
# Tests
|
2014-01-26 06:35:09 +00:00
|
|
|
#
|
2013-02-03 19:41:13 +00:00
|
|
|
|
2018-11-09 18:28:45 +00:00
|
|
|
test: test-node test-chrome
|
2011-12-15 10:28:16 +00:00
|
|
|
|
2013-02-03 23:01:06 +00:00
|
|
|
test-node: node_modules
|
2013-09-17 21:22:36 +00:00
|
|
|
@printf "==> [Test :: Node.js]\n"
|
2011-12-15 10:28:16 +00:00
|
|
|
@NODE_ENV=test ./node_modules/.bin/mocha \
|
2012-11-29 08:18:25 +00:00
|
|
|
--require ./test/bootstrap \
|
2011-12-15 10:28:16 +00:00
|
|
|
--reporter $(REPORTER) \
|
|
|
|
$(TESTS)
|
|
|
|
|
2014-01-26 06:43:49 +00:00
|
|
|
test-cov: node_modules
|
|
|
|
@NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \
|
2013-02-03 19:41:13 +00:00
|
|
|
--require ./test/bootstrap \
|
|
|
|
$(TESTS) \
|
|
|
|
|
2018-11-09 18:28:45 +00:00
|
|
|
test-chrome: clean-browser chai.js
|
|
|
|
@printf "==> [Test :: Karma (chrome)]\n"
|
2013-11-27 16:15:29 +00:00
|
|
|
@./node_modules/karma/bin/karma start \
|
2018-11-09 18:28:45 +00:00
|
|
|
--single-run --browsers HeadlessChrome
|
2013-09-18 02:13:12 +00:00
|
|
|
|
2015-12-19 16:35:33 +00:00
|
|
|
test-firefox: clean-browser chai.js
|
2015-04-07 06:20:28 +00:00
|
|
|
@printf "==> [Test :: Karma (Firefox)]\n"
|
|
|
|
@./node_modules/karma/bin/karma start \
|
|
|
|
--browsers Firefox
|
|
|
|
|
2015-12-19 16:35:33 +00:00
|
|
|
test-sauce: clean-browser chai.js
|
2013-09-18 02:13:12 +00:00
|
|
|
@printf "==> [Test :: Karma (Sauce)]\n"
|
2013-11-27 16:15:29 +00:00
|
|
|
@CHAI_TEST_ENV=sauce ./node_modules/karma/bin/karma start \
|
2013-09-18 02:13:12 +00:00
|
|
|
--single-run
|
|
|
|
|
2014-01-26 06:47:31 +00:00
|
|
|
test-travisci:
|
2013-09-18 02:13:12 +00:00
|
|
|
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
|
2014-01-26 06:43:49 +00:00
|
|
|
@make test-cov
|
2013-09-18 02:13:12 +00:00
|
|
|
@make test-sauce
|
|
|
|
|
2013-02-03 19:41:13 +00:00
|
|
|
#
|
|
|
|
# Clean up
|
2014-01-26 06:35:09 +00:00
|
|
|
#
|
2013-02-03 19:41:13 +00:00
|
|
|
|
2015-05-27 13:04:16 +00:00
|
|
|
clean: clean-node clean-browser clean-cov
|
2013-02-03 23:01:06 +00:00
|
|
|
|
|
|
|
clean-node:
|
|
|
|
@rm -rf node_modules
|
2013-02-03 19:41:13 +00:00
|
|
|
|
|
|
|
clean-browser:
|
|
|
|
@rm -f chai.js
|
|
|
|
|
2012-07-01 02:54:38 +00:00
|
|
|
clean-cov:
|
2014-01-26 06:43:49 +00:00
|
|
|
@rm -rf coverage
|
2012-07-01 02:54:38 +00:00
|
|
|
|
2013-02-03 23:01:06 +00:00
|
|
|
#
|
|
|
|
# Instructions
|
|
|
|
#
|
|
|
|
|
2014-01-26 06:35:09 +00:00
|
|
|
.PHONY: all
|
2018-11-09 18:28:45 +00:00
|
|
|
.PHONY: test test-all test-node test-chrome test-sauce test-cov
|
2015-05-27 13:04:16 +00:00
|
|
|
.PHONY: clean clean-node clean-browser clean-cov
|
2015-06-03 22:36:25 +00:00
|
|
|
.PHONY: release-patch release-minor release-major
|