Skip to content

Commit a232818

Browse files
committed
Imroving jsonReportIncludePattern usage
1 parent 31093ae commit a232818

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

bin/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env node
1+
#!/usr/bin/env node
22
'use strict'
33
const program = require('commander');
44
const assertThat = require('../lib/assertthat-bdd');
@@ -51,7 +51,7 @@ const settings = {
5151
outputFolder: program.outputFolder || './features/',
5252
jql: program.jql || '',
5353
tags: program.tags || '',
54-
jsonReportIncludePattern: program.jsonReportIncludePattern,
54+
jsonReportIncludePattern: program.jsonReportIncludePattern || '.+.json',
5555
proxyURI: program.proxyURI || process.env.http_proxy,
5656

5757
};

lib/assertthat-bdd.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ const downloadFeatures = function(settings, callback) {
6565

6666
const uploadReports = async function(settings, callback) {
6767
const files = fs.readdirSync(settings.jsonReportFolder);
68+
let jsonReportIncludePattern = ".+.json"
69+
if(settings.jsonReportIncludePattern){
70+
jsonReportIncludePattern = settings.jsonReportIncludePattern;
71+
}
72+
console.log('Using ' + jsonReportIncludePattern + ' when searching for cucumber.json files');
6873
let runId = -1;
6974
for(let i=0;i<files.length;i++){
7075
let filename=path.join(settings.jsonReportFolder,files[i]);
71-
if (filename.indexOf('.json')>=0) {
72-
console.log('sending file ' + filename + ' with runId ' + runId);
73-
const res = sendReport(settings,filename,runId);
74-
await res.then(res => { runId=JSON.parse(res.text).runId});
76+
if (filename.indexOf('.json')>=0 && new RegExp(jsonReportIncludePattern, 'gi').test(files[i])) {
77+
console.log('Sending file ' + filename + ' with runId ' + runId);
78+
const res = sendReport(settings,filename,runId);
79+
await res.then(res => { runId=JSON.parse(res.text).runId});
7580
}
7681
}
7782

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@assertthat/assertthat-bdd",
3-
"version": "1.9.2",
3+
"version": "1.9.3",
44
"description": "Node.js module for integration with AssertThat BDD Jira plugin",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)