Skip to content

Commit e76c5a8

Browse files
committed
fix: fixed regex for extracting JSON from @QaseFields
- Updated regex to correctly extract the JSON object after @QaseFields= - Added support for strings like '@QaseFields={"key":"value"}' - Fixed issue with incorrect capture group
1 parent f656a34 commit e76c5a8

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

qase-cucumberjs/changelog.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
3+
## What's new
4+
5+
Fixed the issue with the `QaseFields` tag.
6+
17
28

39
## What's new
@@ -7,11 +13,11 @@ Support attachments in the test results.
713
```js
814
const { Given, Then } = require('cucumber');
915

10-
Given('I have a step with attachment', async function () {
16+
Given('I have a step with attachment', async function() {
1117
await this.attach('Hello, world!', 'text/plain');
1218
});
1319

14-
Then('I have a step with attachment', async function () {
20+
Then('I have a step with attachment', async function() {
1521
await this.attach('Hello, world!', 'text/plain');
1622
});
1723
```

qase-cucumberjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cucumberjs-qase-reporter",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Qase TMS CucumberJS Reporter",
55
"homepage": "https://github.com/qase-tms/qase-javascript",
66
"main": "./dist/index.js",

qase-cucumberjs/src/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type TestStepResultStatus = (typeof Status)[keyof typeof Status];
2727
const qaseIdRegExp = /^@[Qq]-?(\d+)$/g;
2828
const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+)$/g;
2929
const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/g;
30-
const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields:(.+?)=(.+)$/g;
30+
const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields=(.+)$/g;
3131
const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/g;
3232

3333
export class Storage {
@@ -346,7 +346,7 @@ export class Storage {
346346
}
347347

348348
if (qaseFieldsRegExp.test(tag.name)) {
349-
const value = tag.name.replace(/^@[Qq]ase[Ff]ields:/, '');
349+
const value = tag.name.replace(/^@[Qq]ase[Ff]ields=/, '');
350350
try {
351351
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
352352
const record: Record<string, string> = JSON.parse(value);

0 commit comments

Comments
 (0)