Comparing version 0.9.1 to 0.9.2
@@ -1944,2 +1944,4 @@ /*! | ||
var start = new Date().getTime(); | ||
var textareas = options.textareas; | ||
var displayErrorsByDefault = options.displayErrorsByDefault; | ||
@@ -1993,4 +1995,4 @@ function setText(el, txt) { | ||
var aList = document.createElement('ol'); | ||
aList.style.display = 'none'; | ||
test.onclick = function () { | ||
aList.style.display = displayErrorsByDefault ? 'block' : 'none'; | ||
(displayErrorsByDefault ? strong : test).onclick = function () { | ||
var d = aList.style.display; | ||
@@ -2004,3 +2006,5 @@ aList.style.display = (d == 'none') ? 'block': 'none'; | ||
li.innerHTML = (a.message || a.method || 'no message') + | ||
'<pre>' + (a.error.stack || a.error) + '</pre>'; | ||
(textareas ? | ||
'<textarea rows="20" cols="100">' + (a.error.stack || a.error) + '</textarea>' : | ||
'<pre>' + (a.error.stack || a.error) + '</pre>'); | ||
li.className = 'fail'; | ||
@@ -2007,0 +2011,0 @@ } |
@@ -34,5 +34,7 @@ /*! | ||
exports.run = function (modules, options, callback) { | ||
var start = new Date().getTime(), div; | ||
options = options || {}; | ||
div = options.div || document.body; | ||
var start = new Date().getTime(), div, textareas, displayErrorsByDefault; | ||
options = options || {}; | ||
div = options.div || document.body; | ||
textareas = options.textareas; | ||
displayErrorsByDefault = options.displayErrorsByDefault; | ||
@@ -86,4 +88,4 @@ function setText(el, txt) { | ||
var aList = document.createElement('ol'); | ||
aList.style.display = 'none'; | ||
test.onclick = function () { | ||
aList.style.display = displayErrorsByDefault ? 'block' : 'none'; | ||
(displayErrorsByDefault ? strong : test).onclick = function () { | ||
var d = aList.style.display; | ||
@@ -97,3 +99,5 @@ aList.style.display = (d == 'none') ? 'block': 'none'; | ||
li.innerHTML = (a.message || a.method || 'no message') + | ||
'<pre>' + (a.error.stack || a.error) + '</pre>'; | ||
(textareas ? | ||
'<textarea rows="20" cols="100">' + (a.error.stack || a.error) + '</textarea>' : | ||
'<pre>' + (a.error.stack || a.error) + '</pre>'); | ||
li.className = 'fail'; | ||
@@ -100,0 +104,0 @@ } |
@@ -155,22 +155,31 @@ /*! | ||
var client = http.createClient(port, hostname); | ||
client.fetch = function (method, path, headers, respReady) { | ||
var request = this.request(method, path, headers); | ||
request.end(); | ||
request.on('response', function (response) { | ||
response.setEncoding('utf8'); | ||
response.on('data', function (chunk) { | ||
if (response.body) { | ||
response.body += chunk; | ||
} else { | ||
response.body = chunk; | ||
} | ||
var agent = new http.Agent({ host: hostname, port: port, maxSockets: 1 }); | ||
var client = { | ||
fetch: function (method, path, headers, respReady) { | ||
var request = http.request({ | ||
host: hostname, | ||
port: port, | ||
agent: agent, | ||
method: method, | ||
path: path, | ||
headers: headers | ||
}); | ||
response.on('end', function () { | ||
if (response.headers['content-type'] === 'application/json') { | ||
response.bodyAsObject = JSON.parse(response.body); | ||
} | ||
respReady(response); | ||
request.end(); | ||
request.on('response', function (response) { | ||
response.setEncoding('utf8'); | ||
response.on('data', function (chunk) { | ||
if (response.body) { | ||
response.body += chunk; | ||
} else { | ||
response.body = chunk; | ||
} | ||
}); | ||
response.on('end', function () { | ||
if (response.headers['content-type'] === 'application/json') { | ||
response.bodyAsObject = JSON.parse(response.body); | ||
} | ||
respReady(response); | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -200,5 +209,7 @@ | ||
var e = assertion.error; | ||
if (e.actual && e.expected) { | ||
if (typeof e.actual !== 'undefined' && typeof e.expected !== 'undefined') { | ||
var actual = util.inspect(e.actual, false, 10).replace(/\n$/, ''); | ||
var expected = util.inspect(e.expected, false, 10).replace(/\n$/, ''); | ||
var multiline = ( | ||
@@ -205,0 +216,0 @@ actual.indexOf('\n') !== -1 || |
{ | ||
"name": "nodeunit", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Easy unit testing for node.js and the browser.", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -44,3 +44,3 @@ Nodeunit | ||
exports.testSomething = function(test){ | ||
exports.testSomething = function(test) { | ||
test.expect(1); | ||
@@ -51,3 +51,3 @@ test.ok(true, "this assertion should pass"); | ||
exports.testSomethingElse = function(test){ | ||
exports.testSomethingElse = function(test) { | ||
test.ok(false, "this assertion should fail"); | ||
@@ -138,3 +138,3 @@ test.done(); | ||
var _readFile = fs.readFile; | ||
fs.readFile = function(path, callback){ | ||
fs.readFile = function(path, callback) { | ||
// it's a stub! | ||
@@ -141,0 +141,0 @@ }; |
@@ -33,5 +33,7 @@ /* | ||
performBasicChecks(betterErrorString); | ||
betterErrorString.should.include("true"); | ||
betterErrorString.should.include("false"); | ||
betterErrorString.should.include("=="); | ||
test.done(); | ||
@@ -38,0 +40,0 @@ } |
@@ -119,4 +119,4 @@ var assert = require('assert'), | ||
// git doesn't like empty directories, so we have to create one | ||
path.exists(dir2, function (exists) { | ||
if (!exists) { | ||
fs.access(dir2, function (err) { | ||
if (err) { | ||
fs.mkdirSync(dir2, 0777); | ||
@@ -123,0 +123,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
791190
8012