nightwatch
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -144,3 +144,3 @@ /** | ||
} | ||
throw new Error('External global file could not be located - using '+ file +'.') | ||
throw new Error('External global file could not be located - using '+ file +'.'); | ||
} catch (err) { | ||
@@ -220,3 +220,3 @@ err.message = 'Failed to load external global file: ' + err.message; | ||
// setting the source of the test(s) | ||
// setting the path where the tests are located | ||
var testsource; | ||
@@ -250,2 +250,3 @@ if (typeof argv.t == 'string') { | ||
output_folder : output_folder, | ||
src_folders : settings.src_folders, | ||
selenium : (settings.selenium || null) | ||
@@ -252,0 +253,0 @@ }, function(err) { |
@@ -217,9 +217,11 @@ /*! | ||
var instance = new F(); | ||
m.command = instance.command; | ||
m.command = function() { | ||
var instance = new F(); | ||
if (typeof module === 'function') { | ||
context = m.context = instance; | ||
} | ||
instance.command.apply(context, arguments); | ||
return context; | ||
}; | ||
if (typeof module === 'function') { | ||
m.context = instance; | ||
} | ||
return m; | ||
@@ -226,0 +228,0 @@ } |
{ | ||
"name": "nightwatch", | ||
"description": "A node.js bindings implementation for selenium 2.0/webdriver", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Andrei Rusu", |
@@ -7,3 +7,3 @@ var fs = require('fs'), | ||
exports.save = function(results, folder, callback) { | ||
var tmpl = __dirname + "/junit.xml.ejs"; | ||
var tmpl = __dirname + '/junit.xml.ejs'; | ||
@@ -35,3 +35,3 @@ fs.readFile(tmpl, function (err, data) { | ||
failures : failures, | ||
systemerr : results.errmessages.join("\n") | ||
systemerr : results.errmessages.join('\n') | ||
} | ||
@@ -38,0 +38,0 @@ }); |
@@ -26,3 +26,2 @@ /** | ||
function runModule(module, opts, moduleName, callback, finishCallback) { | ||
var client; | ||
@@ -33,3 +32,3 @@ try { | ||
console.log(err.stack); | ||
finishCallback(err); | ||
finishCallback(err, false); | ||
return; | ||
@@ -161,2 +160,12 @@ } | ||
function processExitListener() { | ||
process.on('exit', function(code) { | ||
if (globalResults.errors > 0 || globalResults.failed > 0) { | ||
process.exit(1); | ||
} else { | ||
process.exit(code); | ||
} | ||
}); | ||
} | ||
function wrapTest(setUp, tearDown, fn, context, onComplete, client) { | ||
@@ -251,2 +260,32 @@ return function (c) { | ||
/** | ||
* Get any subfolders relative to the base module path so that we can save the report files into their corresponding subfolders | ||
* | ||
* @param {string} modulePath | ||
* @param {object} aditional_opts | ||
* @returns {string} | ||
*/ | ||
function getPathDiff(modulePath, aditional_opts) { | ||
var pathParts = modulePath.split(path.sep); | ||
pathParts.pop(); | ||
var moduleFolder = pathParts.join(path.sep); | ||
var diffInFolder = '', srcFolder; | ||
if (Array.isArray(aditional_opts.src_folders)) { | ||
for (var i = 0; i < aditional_opts.src_folders.length; i++) { | ||
srcFolder = path.resolve(aditional_opts.src_folders[i]); | ||
if (moduleFolder.indexOf(srcFolder) === 0) { | ||
diffInFolder = moduleFolder.substring(srcFolder.length); | ||
break; | ||
} | ||
} | ||
} else if (typeof aditional_opts.src_folders == 'string') { | ||
if (moduleFolder.indexOf(aditional_opts.src_folders) === 0) { | ||
diffInFolder = moduleFolder.substring(aditional_opts.src_folders.length); | ||
} | ||
} | ||
return diffInFolder; | ||
} | ||
this.run = function runner(files, opts, aditional_opts, finishCallback) { | ||
@@ -257,2 +296,3 @@ var start = new Date().getTime(); | ||
var paths; | ||
finishCallback = finishCallback || function() {}; | ||
@@ -271,2 +311,3 @@ | ||
} | ||
runFiles(paths, function runTestModule(err, fullpaths) { | ||
@@ -284,3 +325,3 @@ if (!fullpaths || fullpaths.length === 0) { | ||
} catch (err) { | ||
finishCallback(err); | ||
finishCallback(err, false); | ||
throw err; | ||
@@ -312,5 +353,7 @@ } | ||
var output = aditional_opts.output_folder; | ||
var diffInFolder = getPathDiff(modulePath, aditional_opts); | ||
var output = path.join(aditional_opts.output_folder, diffInFolder); | ||
var success = globalResults.failed === 0 && globalResults.errors === 0; | ||
if (output === false) { | ||
finishCallback(null); | ||
finishCallback(null, success); | ||
} else { | ||
@@ -321,3 +364,3 @@ mkpath(output, function(err) { | ||
console.log(err.stack); | ||
finishCallback(null); | ||
finishCallback(null, success); | ||
return; | ||
@@ -331,3 +374,3 @@ } | ||
} | ||
finishCallback(null); | ||
finishCallback(null, success); | ||
}); | ||
@@ -339,4 +382,6 @@ }); | ||
}, opts); | ||
processExitListener(); | ||
}; | ||
})(); | ||
@@ -53,3 +53,3 @@ var Api = require('../../lib/api.js'); | ||
test.equal(command.name, 'customCommandConstructor'); | ||
test.equal(command.context.client, client, 'Command should contain a reference to main client instance.'); | ||
test.equal(command.context, client.api, 'Command should contain a reference to main client instance.'); | ||
}, | ||
@@ -56,0 +56,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
257125
7368