Comparing version 0.0.14 to 0.0.15
YUI({ | ||
logInclude: { TestRunner: true }, | ||
gallery: 'gallery-2011.06.22-20-13' | ||
}).use('gallery-jute', 'toolbar', function(Y) { | ||
}).use('test', 'toolbar', function(Y) { | ||
@@ -24,3 +23,3 @@ var suite = new Y.Test.Suite('toolbar'); | ||
Y.Test.Runner.add(suite); | ||
Y.UnitTest.go(); | ||
Y.Test.Runner.run(); | ||
}); |
@@ -37,15 +37,2 @@ /* | ||
YUI().add('jute', function(Y) { | ||
if (window.__done) { | ||
// V8!! | ||
Y.namespace('UnitTest').go = function() { Y.Test.Runner.run(); }; | ||
Y.Test.Runner.subscribe(Y.Test.Runner.COMPLETE_EVENT, | ||
function(data) { | ||
var cover_out = Y.Test.Runner.getCoverage(Y.Coverage.Format.JSON), | ||
report_data = Y.Test.Format.JUnitXML(data.results); | ||
window.__done(data, report_data, cover_out); | ||
} | ||
); | ||
} else { | ||
// BROWSER!! | ||
var UT = Y.namespace('UnitTest'), button, load_button, kick_button, clear_button, clear_results; | ||
@@ -277,48 +264,3 @@ | ||
} | ||
}, '1.0', { requires: [ 'node', 'io-base', 'json' ] }); | ||
Y.Test.Runner.subscribe(Y.Test.Runner.COMPLETE_EVENT, | ||
function(data) { | ||
var cover_out = Y.Test.Runner.getCoverage(Y.Coverage.Format.JSON), | ||
report_data = Y.Test.Format.JUnitXML(data.results); | ||
Y.io('/jute/_test_report', | ||
{ | ||
method: 'PUT', | ||
data: 'results=' + escape(report_data) + '&name=' + escape(data.results.name) + "&coverage=" + escape(cover_out), | ||
on: { | ||
success: function(tid, args) { | ||
if (!window.location.toString().match("_one_shot")) { | ||
window.location.href = '/jute_docs/run_tests.html'; | ||
} | ||
}, | ||
failure: function(tid, args) { | ||
if (!window.location.toString().match("_one_shot")) { | ||
window.location.href = '/jute_docs/run_tests.html'; | ||
} | ||
} | ||
} | ||
} | ||
); | ||
} | ||
); | ||
// some boilerplate stuff | ||
UT.go = function() { | ||
//initialize the console | ||
var yconsole = new Y.Console({ | ||
newestOnTop: false | ||
}); | ||
yconsole.render('#log'); | ||
//run the tests | ||
try { | ||
Y.Test.Runner.run(); | ||
} | ||
catch (e) { | ||
// skip this test - pop & move on | ||
Y.io('/jute/_pop', { on: { end: function() { window.location.href = '/jute_docs/run_tests.html'; } } }); | ||
} | ||
}; | ||
} | ||
}, '1.0', { requires: [ 'node', 'test', 'io-base', 'console', 'json' ] }); | ||
@@ -39,5 +39,11 @@ /* | ||
Create: function(hub) { | ||
var path = require('path'), | ||
fs = require('fs'); | ||
// Events I care about | ||
hub.addListener('startServer', startServer); | ||
// Get this ready to go | ||
var juteClient = fs.readFileSync(path.join(__dirname, 'jute_docs', 'jute_client.js'), 'utf8'); | ||
function startServer() { | ||
@@ -49,3 +55,2 @@ | ||
sys = require('sys'), | ||
path = require('path'), | ||
uuid = require('node-uuid'); | ||
@@ -148,4 +153,3 @@ | ||
var fs = require('fs'), | ||
mime = require('mime'); | ||
var mime = require('mime'); | ||
@@ -174,3 +178,25 @@ fs.stat(path, function(err, stat) { | ||
fs.createReadStream(path).pipe(res); | ||
// dynamically inject JUTE? | ||
if (type.match(/javascript/)) { | ||
var file = fs.readFileSync(path, 'utf8'), | ||
regex = /\)\s*\.\s*use\s*\(([^)]+)/; | ||
var matches = regex.exec(file); | ||
if (matches) { | ||
if (matches[1].match('test')) { | ||
hub.emit(hub.LOG, hub.INFO, "Dynamically injecting JUTE client into " + path); | ||
res.setHeader('Content-Length', stat.size + juteClient.length); | ||
res.write(juteClient); | ||
res.end(file.replace('test', 'jute')); | ||
return; | ||
} | ||
} | ||
// Nope, just some plain old JS file... | ||
res.end(file); | ||
} else { | ||
fs.createReadStream(path).pipe(res); | ||
} | ||
}); | ||
@@ -177,0 +203,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["selenium", "test", "testing", "unit", "tests"], | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"author": "Mark Ethan Trostler <mark@zzo.com>", | ||
@@ -8,0 +8,0 @@ "preferGlobal": true, |
Sorry, the diff of this file is not supported yet
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
3134
1960747
60