Comparing version 0.6.4 to 0.7.0
@@ -5,3 +5,5 @@ var QUnit = require('qunitjs'), | ||
trace = require('tracejs').trace, | ||
coverage = require('./coverage'); | ||
coverage = require('./coverage'), | ||
generators = require('./generators'), | ||
co = require('co'); | ||
@@ -111,2 +113,30 @@ // cycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle, | ||
if (generators.support) { | ||
var test = QUnit.test; | ||
/** | ||
* Support generators. | ||
*/ | ||
global.test = QUnit.test = function(testName, expected, callback, async) { | ||
var fn; | ||
if ( arguments.length === 2 ) { | ||
callback = expected; | ||
expected = null; | ||
} | ||
if (generators.isGeneratorFn(callback)) { | ||
fn = function() { | ||
stop(); | ||
co(callback)(); | ||
start(); | ||
}; | ||
} else { | ||
fn = callback; | ||
} | ||
return test.call(this, testName, expected, fn, async); | ||
}; | ||
} | ||
/** | ||
@@ -113,0 +143,0 @@ * Provide better stack traces |
{ | ||
"name": "qunit", | ||
"description": "QUnit testing framework for nodejs", | ||
"version": "0.6.4", | ||
"author": "Oleg Slobodskoi <oleg008@gmail.com>", | ||
"contributors": [ | ||
{"name": "Jonathan Buchanan"}, | ||
{"name": "Ashar Voultoiz"}, | ||
{"name": "Drew Fyock"} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/kof/node-qunit.git" | ||
"name": "qunit", | ||
"description": "QUnit testing framework for nodejs", | ||
"version": "0.7.0", | ||
"author": "Oleg Slobodskoi <oleg008@gmail.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Jonathan Buchanan" | ||
}, | ||
"keywords": ["TDD", "QUnit", "unit", "testing", "tests", "async"], | ||
"bin": {"qunit": "./bin/cli.js"}, | ||
"engines": {"node": ">=0.6.0 < 0.11.0"}, | ||
"scripts": { | ||
"test": "node ./test/testrunner.js" | ||
{ | ||
"name": "Ashar Voultoiz" | ||
}, | ||
"dependencies": { | ||
"underscore": "^1.6.0", | ||
"argsparser": "^0.0.6", | ||
"cli-table": "^0.3.0", | ||
"tracejs": "^0.1.8", | ||
"qunitjs": "1.10.0" | ||
}, | ||
"devDependencies": { | ||
"chainer": "^0.0.5", | ||
"timekeeper": "^0.0.4" | ||
}, | ||
"optionalDependencies": { | ||
"istanbul": "^0.2.4" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http: //www.opensource.org/licenses/mit-license.php" | ||
} | ||
] | ||
{ | ||
"name": "Drew Fyock" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/kof/node-qunit.git" | ||
}, | ||
"keywords": [ | ||
"TDD", | ||
"QUnit", | ||
"unit", | ||
"testing", | ||
"tests", | ||
"async" | ||
], | ||
"bin": { | ||
"qunit": "./bin/cli.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.6.0 < 0.12.0" | ||
}, | ||
"scripts": { | ||
"test": "node --harmony ./test/testrunner.js" | ||
}, | ||
"dependencies": { | ||
"argsparser": "^0.0.6", | ||
"cli-table": "^0.3.0", | ||
"co": "^3.0.6", | ||
"qunitjs": "1.10.0", | ||
"tracejs": "^0.1.8", | ||
"underscore": "^1.6.0" | ||
}, | ||
"devDependencies": { | ||
"chainer": "^0.0.5", | ||
"timekeeper": "^0.0.4" | ||
}, | ||
"optionalDependencies": { | ||
"istanbul": "https://github.com/gotwarlost/istanbul/tarball/harmony" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http: //www.opensource.org/licenses/mit-license.php" | ||
} | ||
] | ||
} |
@@ -18,2 +18,3 @@ ## QUnit testing framework for nodejs. | ||
- you can run the same tests in browser if there is no dependencies to node | ||
- generators support | ||
@@ -180,3 +181,3 @@ ### Installation | ||
test("a basic test example", function (assert) { | ||
test("a basic test example", function () { | ||
ok(true, "this test is fine"); | ||
@@ -189,7 +190,7 @@ var value = "hello"; | ||
test("first test within module", 1, function (assert) { | ||
test("first test within module", 1, function () { | ||
ok(true, "a dummy"); | ||
}); | ||
test("second test within module", 2, function (assert) { | ||
test("second test within module", 2, function () { | ||
ok(true, "dummy 1 of 2"); | ||
@@ -208,3 +209,3 @@ ok(true, "dummy 2 of 2"); | ||
test("some other test", function (assert) { | ||
test("some other test", function () { | ||
expect(2); | ||
@@ -222,7 +223,7 @@ equal(true, false, "failing test"); | ||
test("this test is using shared environment", 1, function (assert) { | ||
test("this test is using shared environment", 1, function () { | ||
deepEqual({ test: 123 }, this.options, "passing test"); | ||
}); | ||
test("this is an async test example", function (assert) { | ||
test("this is an async test example", function () { | ||
expect(2); | ||
@@ -237,3 +238,9 @@ stop(); | ||
### Generators support | ||
test("my async test with generators", function* () { | ||
var data = yield asyncFn(); | ||
equal(data, {a: 1}, 'generators work'); | ||
}); | ||
### Run tests | ||
@@ -240,0 +247,0 @@ |
@@ -6,3 +6,4 @@ var a = require('assert'), | ||
var tr = require('../lib/testrunner'), | ||
log = require('../lib/log'); | ||
log = require('../lib/log'), | ||
generators = require('../lib/generators'); | ||
@@ -179,2 +180,3 @@ var fixtures = __dirname + '/fixtures', | ||
a.deepEqual(stat, res, 'coverage code testing works'); | ||
tr.options.coverage = false; | ||
chain.next(); | ||
@@ -184,2 +186,24 @@ }); | ||
if (generators.support) { | ||
chain.add('generators', function() { | ||
tr.run({ | ||
code: fixtures + '/generators-code.js', | ||
tests: fixtures + '/generators-test.js' | ||
}, function(err, res) { | ||
var stat = { | ||
files: 1, | ||
tests: 1, | ||
assertions: 1, | ||
failed: 0, | ||
passed: 1 | ||
}; | ||
delete res.runtime; | ||
delete res.coverage; | ||
a.equal(err, null, 'no errors'); | ||
a.deepEqual(stat, res, 'coverage code testing works'); | ||
chain.next(); | ||
}); | ||
}); | ||
} | ||
chain.add(function() { | ||
@@ -186,0 +210,0 @@ console.log('\nAll tests ok.'); |
43016
29
1109
248
7
+ Addedco@^3.0.6
+ Addedco@3.1.0(transitive)
- Removedabbrev@1.0.9(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedasync@0.2.100.9.2(transitive)
- Removedescodegen@1.3.3(transitive)
- Removedesprima@1.1.11.2.54.0.1(transitive)
- Removedestraverse@1.5.1(transitive)
- Removedesutils@1.0.0(transitive)
- Removedfileset@0.1.8(transitive)
- Removedglob@3.2.11(transitive)
- Removedhandlebars@1.3.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedistanbul@0.2.16(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.00.4.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednopt@3.0.6(transitive)
- Removedoptimist@0.3.7(transitive)
- Removedresolve@0.7.4(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedsource-map@0.1.43(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removeduglify-js@2.3.6(transitive)
- Removedwhich@1.0.9(transitive)
- Removedwordwrap@0.0.3(transitive)