Skip to content

Commit

Permalink
Fix for import descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranav Parikh committed Mar 14, 2014
1 parent 3586a0b commit 02321aa
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/util/dataprovider.js
Expand Up @@ -60,7 +60,7 @@ DataProvider.prototype.getTestData = function () {
contextObj = qs.parse(this.context, ",", ":");

if (importDescriptor) {
descriptorJson = this.processImportDescriptor(descriptorJson);
descriptorJson = this.processImportDescriptor(descriptorJson, cwd);
}
console.log('*******descriptorJson ::' + JSON.stringify(descriptorJson));
baseUrl = self.config["baseUrl"];
Expand Down Expand Up @@ -129,8 +129,8 @@ DataProvider.prototype.getTestData = function () {
* @param descriptorJson
* @returns {*}
*/
DataProvider.prototype.processImportDescriptor = function(descriptorJson) {
console.log('\n****In processImportDescriptor');
DataProvider.prototype.processImportDescriptor = function(descriptorJson, cwd) {
console.log('\n****In processImportDescriptor, cwd::' + cwd);
var
importedDescriptorJsonStr,
importedDescriptorJson,
Expand All @@ -144,15 +144,18 @@ DataProvider.prototype.processImportDescriptor = function(descriptorJson) {
addTest,
self = this,
baseUrl = self.config["baseUrl"],
cwd = global.workingDirectory,
// cwd = global.workingDirectory,
pathSep = global.pathSep || path.Sep || '/',
relPathDirName,
commonLib;

try {

relativePath = self.testDataPath.substring(0, self.testDataPath.lastIndexOf(pathSep));
console.log('\n\n******relativePath::' + relativePath);
console.log('\n\n******self.testDataPath::' + self.testDataPath);
// relativePath = self.testDataPath.substring(0, self.testDataPath.lastIndexOf(pathSep));
console.log('\n\n******relativePath::' + path.dirname(self.testDataPath));
relativePath = path.dirname(self.testDataPath);
// console.log('\n\n******relativePath::' + relativePath);

// Retain regular tests
if (descriptorJson[0] && descriptorJson[0].dataprovider) {
Expand All @@ -162,11 +165,12 @@ DataProvider.prototype.processImportDescriptor = function(descriptorJson) {
}

importedDescriptorArr = descriptorJson[0].importDescriptor;
console.log('\n\n******importedDescriptorArr::' + importedDescriptorArr.length);
console.log('\n\n******importedDescriptorArr length::' + importedDescriptorArr.length);

var importDescriptorAbsPath;

for (var i = 0; i < importedDescriptorArr.length; i+=1) {

console.log('\n\n******cwd::' + cwd);
console.log('\n\n******importDescriptor path::' + path.join(cwd, descriptorJson[0].importDescriptor[i].path));
relPathDirName = path.dirname(path.join(cwd, descriptorJson[0].importDescriptor[i].path));
console.log('\n\n*******Path dirname ::' + relPathDirName);
Expand Down Expand Up @@ -196,6 +200,8 @@ DataProvider.prototype.processImportDescriptor = function(descriptorJson) {

commonLib = importJson.commonlib;
// console.log('\n\n***ImportJson::' + JSON.stringify(importJson));

// Resolve common libs
if (commonLib) {
console.log('\n\n***Common Lib to import::' + commonLib);
var newCommonLib = '';
Expand Down

0 comments on commit 02321aa

Please sign in to comment.