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

Update to support latest version of nodeunit #2

Merged
merged 1 commit into from Sep 27, 2011
Merged
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
58 changes: 33 additions & 25 deletions lib/nodeunit-dsl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/nodeunit-dsl.coffee
Expand Up @@ -27,19 +27,19 @@ exports.run = (name) ->
testStart: -> testStart: ->
fn() for fn in befores fn() for fn in befores
testDone: (name, assertions) -> testDone: (name, assertions) ->
failures = if typeof(assertions.failures) is "function" then assertions.failures() else assertion.failures
fn() for fn in afters fn() for fn in afters
if not assertions.failures if not failures
sys.puts "✔ #{name}" sys.puts "✔ #{name}"
else else
sys.puts red "✖ #{name}" sys.puts red "✖ #{name}"
for assertion in assertions when assertion.failed() for assertion in assertions when assertion.failed()
sys.puts assertion.error.stack + "\n" sys.puts assertion.error.stack + "\n"
moduleDone: (name, assertions) -> moduleDone: (name, assertions) ->
if assertions.failures failures = if typeof(assertions.failures) is "function" then assertions.failures() else assertion.failures
sys.puts bold(red( if failures
"\nFAILURES #{assertions.failures} / #{assertions.length} " + sys.puts bold(red("\nFAILURES #{failures} / #{assertions.length} " +
" assertions failed (#{assertions.duration} ms)")) " assertions failed (#{assertions.duration} ms)"))
else else
sys.puts bold(green( sys.puts bold(green("\nOK: #{assertions.length} assertions(#{assertions.duration} ms)"))
"\nOK: #{assertions.length} assertions(#{assertions.duration} ms)")) }, (->)
}, (->)
11 changes: 11 additions & 0 deletions test/issue-1.js
@@ -0,0 +1,11 @@
var dsl = require('nodeunit-dsl'),
test = dsl.test,
run = dsl.run;

if (module.id === '.') run(__filename);

test('the total number of failures is evaluated correctly', function(t) {
t.ok(true);
t.done();
});