diff --git a/lib/plugin/allure.js b/lib/plugin/allure.js index e902a9457..2c7bcc048 100644 --- a/lib/plugin/allure.js +++ b/lib/plugin/allure.js @@ -82,6 +82,13 @@ module.exports = (config) => { currentStep = null; }); + event.dispatcher.on(event.test.started, (test) => { + const currentTest = reporter.getCurrentTest(); + for (const tag of test.tags) { + currentTest.addLabel('tag', tag); + } + }); + event.dispatcher.on(event.test.failed, (test, err) => { if (currentStep) reporter.endStep('failed'); if (currentMetaStep.length) { diff --git a/lib/ui.js b/lib/ui.js index 3b6e9d173..2a2631909 100644 --- a/lib/ui.js +++ b/lib/ui.js @@ -52,7 +52,7 @@ module.exports = function (suite) { }); }; - test.tags = (suite.tags || []).concat(title.match(/(\@\w+)/g)); // match tags from title + test.tags = (suite.tags || []).concat(title.match(/(\@[a-zA-Z0-9-_]+)/g)); // match tags from title test.file = file; test.async = true; test.timeout(0); @@ -97,7 +97,7 @@ module.exports = function (suite) { if (opts.retries) suite.retries(opts.retries); if (opts.timeout) suite.timeout(opts.timeout); - suite.tags = title.match(/(\@\w+)/g) || []; // match tags from title + suite.tags = title.match(/(\@[a-zA-Z0-9-_]+)/g) || []; // match tags from title suite.file = file; suite.fullTitle = () => `${suite.title}:`; suites.unshift(suite);