Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/data/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = function (context) {
.inject({ current: dataRow.data }));
}
});
maskSecretInTitle(scenarios);
return new DataScenarioConfig(scenarios);
},
only: {
Expand All @@ -42,6 +43,7 @@ module.exports = function (context) {
.inject({ current: dataRow.data }));
}
});
maskSecretInTitle(scenarios);
return new DataScenarioConfig(scenarios);
},
},
Expand Down Expand Up @@ -71,12 +73,6 @@ function replaceTitle(title, dataRow) {
// it should be printed
if (Object.prototype.toString.call(dataRow.data) === (Object()).toString()
&& dataRow.data.toString() !== (Object()).toString()) {
Object.entries(dataRow.data).forEach(entry => {
const [key, value] = entry;
if (value instanceof Secret) {
dataRow.data[key] = value.getMasked();
}
});
return `${title} | ${dataRow.data}`;
}

Expand Down Expand Up @@ -119,3 +115,15 @@ function detectDataType(dataTable) {

throw new Error('Invalid data type. Data accepts either: DataTable || generator || Array || function');
}

function maskSecretInTitle(scenarios) {
scenarios.forEach(scenario => {
const res = [];

scenario.test.title.split(',').forEach(item => {
res.push(item.replace(/{"_secret":"(.*)"}/, '"*****"'));
});

scenario.test.title = res.join(',');
});
}