Skip to content

Commit

Permalink
Cleanup of tests, getting test_all.js to work correctly, fixed error …
Browse files Browse the repository at this point in the history
…handling in replicasetserver to avoid double callbacks
  • Loading branch information
christkv committed May 24, 2011
1 parent ceae93b commit f04f8f1
Show file tree
Hide file tree
Showing 83 changed files with 7,618 additions and 568 deletions.
3 changes: 3 additions & 0 deletions deps/nodeunit/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
stamp-build
test/fixtures/dir2
60 changes: 60 additions & 0 deletions deps/nodeunit/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Nodeunit contributors (sorted alphabeticaly)
============================================

* **[Alex Gorbatchev](https://github.com/alexgorbatchev)**

* Deeper default object inspection
* Timeout to ensure flushing of console output (default reporter)

* **[Alex Wolfe](https://github.com/alexkwolfe)**

* HTML test reporter

* **[Caolan McMahon](https://github.com/caolan)**

* Author and maintainer
* Most features develpopment

* **[Carl Fürstenberg](https://github.com/azatoth)**

* Debian-friendly Makefile, supports both 'node' and 'nodejs' executables
* Sandbox utility
* Minimal test reporter

* **[Gerad Suyderhoud](https://github.com/gerad)**

* First comand-line tool

* **[Kadir Pekel](https://github.com/coffeemate)**

* Improvements to default test reporter
* HTTP test utility

* **[Matthias Lübken](https://github.com/luebken)**

* Utility functions for tracking incomplete tests on exit

* **[Oleg Efimov](https://github.com/Sannis)**

* Adding 'make lint' and fixing nodelint errors
* Option parsing, --help text and config file support
* Reporters option for command-line tool

* **[Orlando Vazquez](https://github.com/orlandov)**

* Added jUnit XML reporter

* **[Ryan Dahl](https://github.com/ry)**

* Add package.json

* **[Sam Stephenson](https://github.com/sstephenson)**

* Coffee-script support

* **[Thomas Mayfield](https://github.com/thegreatape)**

* Async setUp and tearDown support for testCase

**[Full contributors list](https://github.com/caolan/nodeunit/contributors).**

19 changes: 19 additions & 0 deletions deps/nodeunit/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2010 Caolan McMahon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
126 changes: 126 additions & 0 deletions deps/nodeunit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
PACKAGE = nodeunit
NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(PREFIX)/share/man
LIBDIR ?= $(PREFIX)/lib
NODEJSLIBDIR ?= $(LIBDIR)/$(NODEJS)

BUILDDIR = dist

DOCS = $(shell find doc -name '*.md' \
|sed 's|.md|.1|g' \
|sed 's|doc/|man1/|g' \
)


$(shell if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi)

all: build doc

browser:
# super hacky build script for browser version!
mkdir -p $(BUILDDIR)/browser
rm -rf $(BUILDDIR)/browser/*
# build browser version of nodeunit.js
cat share/license.js >> $(BUILDDIR)/browser/nodeunit.js
echo "nodeunit = (function(){" >> $(BUILDDIR)/browser/nodeunit.js
cat deps/json2.js >> $(BUILDDIR)/browser/nodeunit.js
# make assert global
echo "var assert = this.assert = {};" >> $(BUILDDIR)/browser/nodeunit.js
echo "var types = {};" >> $(BUILDDIR)/browser/nodeunit.js
echo "var core = {};" >> $(BUILDDIR)/browser/nodeunit.js
echo "var nodeunit = {};" >> $(BUILDDIR)/browser/nodeunit.js
echo "var reporter = {};" >> $(BUILDDIR)/browser/nodeunit.js
cat deps/async.js >> $(BUILDDIR)/browser/nodeunit.js
echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
cat lib/assert.js >> $(BUILDDIR)/browser/nodeunit.js
echo "})(assert);" >> $(BUILDDIR)/browser/nodeunit.js
echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
cat lib/types.js >> $(BUILDDIR)/browser/nodeunit.js
echo "})(types);" >> $(BUILDDIR)/browser/nodeunit.js
echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
cat lib/core.js >> $(BUILDDIR)/browser/nodeunit.js
echo "})(core);" >> $(BUILDDIR)/browser/nodeunit.js
echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
cat lib/reporters/browser.js >> $(BUILDDIR)/browser/nodeunit.js
echo "})(reporter);" >> $(BUILDDIR)/browser/nodeunit.js
echo "nodeunit = core;" >> $(BUILDDIR)/browser/nodeunit.js
echo "nodeunit.assert = assert;" >> $(BUILDDIR)/browser/nodeunit.js
echo "nodeunit.reporter = reporter;" >> $(BUILDDIR)/browser/nodeunit.js
echo "nodeunit.run = reporter.run;" >> $(BUILDDIR)/browser/nodeunit.js
echo "return nodeunit; })();" >> $(BUILDDIR)/browser/nodeunit.js
sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/nodeunit.js
# copy nodeunit.css
cp share/nodeunit.css $(BUILDDIR)/browser/nodeunit.css
# create nodeunit.min.js
uglifyjs $(BUILDDIR)/browser/nodeunit.js > $(BUILDDIR)/browser/nodeunit.min.js
# create test scripts
mkdir -p $(BUILDDIR)/browser/test
cp test/test.html $(BUILDDIR)/browser/test/test.html
# test-base.js
echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-base.js
cat test/test-base.js >> $(BUILDDIR)/browser/test/test-base.js
echo "})(this.test_base = {});" >> $(BUILDDIR)/browser/test/test-base.js
sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-base.js
# test-runmodule.js
echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runmodule.js
cat test/test-runmodule.js >> $(BUILDDIR)/browser/test/test-runmodule.js
echo "})(this.test_runmodule = {});" >> $(BUILDDIR)/browser/test/test-runmodule.js
sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runmodule.js
# test-runtest.js
echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runtest.js
cat test/test-runtest.js >> $(BUILDDIR)/browser/test/test-runtest.js
echo "})(this.test_runtest = {});" >> $(BUILDDIR)/browser/test/test-runtest.js
sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runtest.js
# test-testcase.js
echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-testcase.js
cat test/test-testcase.js >> $(BUILDDIR)/browser/test/test-testcase.js
echo "})(this.test_testcase = {});" >> $(BUILDDIR)/browser/test/test-testcase.js
sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-testcase.js
# copy nodeunit.js to dist/browser/test to make it easier for me to host and
# run on windows VMs with IE
cp $(BUILDDIR)/browser/nodeunit.js $(BUILDDIR)/browser/test/nodeunit.js
cp $(BUILDDIR)/browser/nodeunit.css $(BUILDDIR)/browser/test/nodeunit.css

build: stamp-build

stamp-build: $(wildcard deps/* lib/*.js)
touch $@;
mkdir -p $(BUILDDIR)/nodeunit
cp -R bin deps index.js lib package.json $(BUILDDIR)/nodeunit
printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/bin/nodeunit $$@' > $(BUILDDIR)/nodeunit.sh

test:
$(NODEJS) ./bin/nodeunit test

install: build
install -d $(NODEJSLIBDIR)
cp -a $(BUILDDIR)/nodeunit $(NODEJSLIBDIR)
install -m 0755 $(BUILDDIR)/nodeunit.sh $(BINDIR)/nodeunit
install -d $(MANDIR)/man1/
cp -a man1/nodeunit.1 $(MANDIR)/man1/

uninstall:
rm -rf $(NODEJSLIBDIR)/nodeunit $(NODEJSLIBDIR)/nodeunit.js $(BINDIR)/nodeunit
rm -rf $(MANDIR)/man1/nodeunit.1

clean:
rm -rf $(BUILDDIR) stamp-build

lint:
nodelint --config nodelint.cfg ./index.js ./bin/nodeunit ./bin/nodeunit.json ./lib/*.js ./lib/reporters/*.js ./test/*.js

doc: man1 $(DOCS)
@true

man1:
@if ! test -d man1 ; then mkdir -p man1 ; fi

# use `npm install ronn` for this to work.
man1/%.1: doc/%.md
ronn --roff $< > $@

.PHONY: browser test install uninstall build all
Loading

0 comments on commit f04f8f1

Please sign in to comment.