allure-framework / allure-js

Allure integrations for JavaScript test frameworks
https://allurereport.org/
Apache License 2.0
224 stars 119 forks source link

PlayWright+Cucumber+ Allure - Allure is not supporting for latest cucumber version 10.8.0 #1082

Open varshanharshank opened 1 month ago

varshanharshank commented 1 month ago

Describe the bug I unable to run cucumber.js file after migrating to the cucumber 10.8 version.It is showing below error.

Error: Failed to import formatter ./src/helper/report/allureReport.ts at importCode (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/formatter/import_code.ts:14:11) at async resolveImplementation (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/formatter/resolve_implementation.ts:13:22) at async initializeFormatter (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/api/formatters.ts:51:28) at async initializeFormatters (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/api/formatters.ts:86:5) at async runCucumber (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/api/run_cucumber.ts:93:29) at async Cli.run (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/cli/index.ts:79:25) at async Object.run [as default] (/Users/test/Documents/Workspace/purpleportalautomation/node_modules/@cucumber/cucumber/src/cli/run.ts:32:14) { [cause]: TypeError: Unknown file extension ".ts" for /Users/test/Documents/Workspace/purpleportalautomation/src/helper/report/allureReport.ts

Note: It is not allowing to import below import { CucumberAllureWorld } from 'allure-cucumberjs'

To Reproduce

Steps to reproduce the behavior:

Migrate cucumber version to latest 10.8 Run the following command npx cucumber-js test --tags '@smoke'

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

//allureReport.ts

/ eslint-disable @typescript-eslint/no-explicit-any / import { AllureRuntime, CucumberJSAllureFormatter } from 'allure-cucumberjs'

function Reporter(options: any) { return new CucumberJSAllureFormatter( options, new AllureRuntime({ resultsDir: 'reports/allure-results' }), { labels: [ { name: 'epic', pattern: [/@feature:(.)/], }, { name: 'severity', pattern: [/@severity:(.)/], }, ], links: [ { type: 'issue', pattern: [/@issue=(.)/], urlTemplate: 'http://localhost:8080/issue/%s', }, { type: 'tms', pattern: [/@tms=(.)/], urlTemplate: 'http://localhost:8080/tms/%s', }, ], } ) }

Reporter.prototype = Object.create(CucumberJSAllureFormatter.prototype) Reporter.prototype.constructor = Reporter

exports.default = Reporter

cucumber.json

{
  "default": {
    "paths": ["src/test/features"],
    "require": ["src/test/stepDefinitions/*.ts", "src/hooks/hooks.ts"],
    "requireModule": ["ts-node/register"],
    "publishQuiet": true,
    "format": [
      "progress-bar",
       "./src/helper/report/allureReport.ts:./output.txt",
      "html:reports/cucumberReport/cucumber-report.html",
      "json:reports/cucumberReport/cucumber-report.json"
    ],
    "parallel": 1
  }
}

package.json

image
SwikritiT commented 3 weeks ago

I'm also having the same problem

MaksymZup commented 4 days ago

same problem