Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Use temporary test-only build of mocha.js for browsers tests. Avoids accidental check-ins of dist file in contributions

Peter Müller8a93a542f177
diff --git a/.eslintignore b/.eslintignore
index d5134e40..1ce4437a 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,4 @@
coverage/
lib/to-iso-string/**/*.js
mocha.js
+BUILDTMP
diff --git a/.gitignore b/.gitignore
index 05cc0172..9b94c5be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ npm-debug.log*
*.orig
.nyc_output/
coverage/
+BUILDTMP/
diff --git a/Makefile b/Makefile
index c7d9e8a3..7abbaad0 100644
--- a/Makefile
+++ b/Makefile
@@ -18,8 +18,9 @@ TESTS = $(shell find test -name "*.js" -type f | sort)
all: mocha.js
-mocha.js: $(SRC) browser-entry.js
+mocha.js BUILDTMP/mocha.js: $(SRC) browser-entry.js
@printf "==> [Browser :: build]\n"
+ mkdir -p ${@D}
$(BROWSERIFY) ./browser-entry \
--plugin ./scripts/dedefine \
--ignore 'fs' \
@@ -29,7 +30,7 @@ mocha.js: $(SRC) browser-entry.js
clean:
@printf "==> [Clean]\n"
- rm -f mocha.js
+ rm -rf BUILDTMP
lint:
@printf "==> [Test :: Lint]\n"
@@ -37,13 +38,13 @@ lint:
test-node: test-bdd test-tdd test-qunit test-exports test-unit test-integration test-jsapi test-compilers test-glob test-requires test-reporters test-only test-global-only
-test-browser: clean mocha.js test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports
+test-browser: clean BUILDTMP/mocha.js test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports
test: lint test-node test-browser
test-browser-unit:
@printf "==> [Test :: Browser]\n"
- NODE_PATH=. $(KARMA) start --single-run
+ NODE_PATH=BUILDTMP $(KARMA) start --single-run
test-browser-bdd:
@printf "==> [Test :: Browser :: BDD]\n"
diff --git a/package.json b/package.json
index d9fd1be3..0ca52f8b 100644
--- a/package.json
+++ b/package.json
@@ -299,10 +299,11 @@
"npm": ">= 1.4.x"
},
"scripts": {
- "test": "make test",
+ "test": "make test && make clean",
"precoverage": "rm -rf coverage",
"coverage": "COVERAGE=true npm run test",
- "postcoverage": "istanbul-combine -d coverage -r lcov -r html coverage/reports/*/*.json"
+ "postcoverage": "istanbul-combine -d coverage -r lcov -r html coverage/reports/*/*.json",
+ "preversion": "make test && make mocha.js && git add mocha.js"
},
"dependencies": {
"browser-stdout": "1.3.0",