Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
varshanharshank opened this issue Jul 29, 2024 · 5 comments
Labels
theme:cucumberjs CucumberJS related issue

Comments

@varshanharshank
Copy link

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):

  • OS: mac sonoma 14.5
  • Browser chrome

//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
@baev baev added the theme:cucumberjs CucumberJS related issue label Aug 5, 2024
@SwikritiT
Copy link

I'm also having the same problem

@MaksymZup
Copy link

same problem

@ddmonteiro
Copy link

same issue, has this been fixed?

@rudyaditya
Copy link

rudyaditya commented Oct 11, 2024

same issue
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
I already put this
requireModule: ['ts-node/register'],

  "devDependencies": {
    "@cucumber/cucumber": "^11.0.1",
    "@cucumber/html-formatter": "^21.7.0",
    "@cucumber/pretty-formatter": "^1.0.1",
    "@playwright/test": "^1.48.0",
    "allure-cucumberjs": "^3.0.4",
    "allure-playwright": "^3.0.4",
    "assert-plus": "^1.0.0",
    "axios": "^1.6.2",
    "cross-env": "^7.0.3",
    "cucumber-console-formatter": "^1.0.0",
    "cucumber-html-reporter": "^7.2.0",
    "dotenv": "^16.3.1",
    "jwt-decode": "^4.0.0",
    "lodash": "^4.17.21",
    "ts-node": "^10.9.1",
    "typescript": "5.2.2",
    "uuid": "^9.0.1"
  }

@arcaneGamer888
Copy link

Same issue. When will this be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:cucumberjs CucumberJS related issue
Projects
None yet
Development

No branches or pull requests

7 participants