Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build mocha.js using browserify #1260

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 20 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ REPORTER ?= spec
TM_BUNDLE = JavaScript\ mocha.tmbundle
SRC = $(shell find lib -name "*.js" -type f | sort)
SUPPORT = $(wildcard support/*.js)
REQUIRE ?= index

all: mocha.js

Expand All @@ -15,23 +16,19 @@ lib/browser/escape-string-regexp.js: node_modules/escape-string-regexp/index.js
mocha.js: $(SRC) $(SUPPORT) lib/browser/diff.js lib/browser/escape-string-regexp.js
@node support/compile $(SRC)
@cat \
support/head.js \
_mocha.js \
support/tail.js \
support/foot.js \
> mocha.js
support/head.js \
_mocha.js \
support/tail.js \
support/foot.js \
> mocha.js

clean:
rm -f mocha.js
rm -fr lib-cov
rm -f coverage.html

test-cov: lib-cov
@COV=1 $(MAKE) test REPORTER=html-cov > coverage.html

lib-cov:
@rm -fr ./$@
@jscoverage lib $@
test-cov:
$(MAKE) test REPORTER=html-cov REQUIRE=blanket > coverage.html

test: test-unit

Expand All @@ -41,8 +38,9 @@ test-jsapi:
@node test/jsapi

test-unit:
@./bin/mocha \
./bin/mocha \
--reporter $(REPORTER) \
--require $(REQUIRE) \
test/acceptance/*.js \
--growl \
test/*.js
Expand Down Expand Up @@ -101,16 +99,16 @@ test-exports:

test-grep:
@./bin/mocha \
--reporter $(REPORTER) \
--grep fast \
test/acceptance/misc/grep
--reporter $(REPORTER) \
--grep fast \
test/acceptance/misc/grep

test-invert:
@./bin/mocha \
--reporter $(REPORTER) \
--grep slow \
--invert \
test/acceptance/misc/grep
--reporter $(REPORTER) \
--grep slow \
--invert \
test/acceptance/misc/grep

test-bail:
@./bin/mocha \
Expand All @@ -120,9 +118,9 @@ test-bail:

test-async-only:
@./bin/mocha \
--reporter $(REPORTER) \
--async-only \
test/acceptance/misc/asyncOnly
--reporter $(REPORTER) \
--async-only \
test/acceptance/misc/asyncOnly

test-glob:
@./test/acceptance/glob/glob.sh
Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@

module.exports = process.env.COV
? require('./lib-cov/mocha')
: require('./lib/mocha');
module.exports = require('./lib/mocha');
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ exports.highlightTags = function(name) {
*/

exports.stringify = function(obj) {
if (obj instanceof RegExp) return obj.toString();
if (obj instanceof RegExp || obj instanceof Date) return obj.toString();
return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1');
}

Expand Down