Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[singletest] added functionality to run a single test

  • Loading branch information...
commit eeb69a22786a762fcaa43fe9693cf05a80eebba1 1 parent 3586530
@dscape authored
View
2  package.json
@@ -1,7 +1,7 @@
{ "name" : "specify"
, "description" : "bite sized node.js testing"
, "author" : "nuno job <nunojobpinto@gmail.com> (http://nunojob.com/)"
-, "version" : "0.3.3"
+, "version" : "0.4.0"
, "main" : "./specify.js"
, "homepage" : "https://github.com/dscape/specify"
, "repository" :
View
4 specify.js
@@ -118,6 +118,10 @@ module.exports = (function specify() {
summary = def_summary;
};
spec.run = function run_all_tests(filter) {
+ if(typeof filter === "function") {
+ cache = [["main", filter]];
+ filter = [];
+ }
console.log();
console.log(" ", module.parent.filename.replace(process.cwd(), ""));
console.log();
View
8 test.sh
@@ -2,11 +2,17 @@ node test/specify.js | sed 's/.\[[0-9][0-9]m//g' | sed 's/"at.*\(.*\)//' \
> test/all.log
node test/specify.js specify#throws specify#cascading_sync \
| sed 's/.\[[0-9][0-9]m//g' | sed 's/"at.*\(.*\)//' > test/filters.log
+node test/singletest.js | sed 's/.\[[0-9][0-9]m//g' > test/single.log
diff test/all.log test/fixtures/all.txt
if [ $? -eq 0 ]; then
diff test/filters.log test/fixtures/filters.txt
if [ $? -eq 0 ]; then
- echo "ok";
+ diff test/single.log test/fixtures/single.txt
+ if [ $? -eq 0 ]; then
+ echo "ok";
+ else
+ return -1;
+ fi
else
return -1;
fi
View
5 test/fixtures/single.txt
@@ -0,0 +1,5 @@
+
+ /test/singletest.js
+
+✔ 1/1 main
+✔ 1/1 summary
View
7 test/singletest.js
@@ -0,0 +1,7 @@
+var specify = require('../specify');
+
+specify.run(
+ function(assert) {
+ setTimeout(function () { assert.ok(true, "was true"); }, 1);
+ }
+);
Please sign in to comment.
Something went wrong with that request. Please try again.