allure-js
allure-js copied to clipboard
PlayWright+Cucumber+ Allure - Allure is not supporting for latest cucumber version 10.3.1
Describe the bug I unable to run cucumber.js file after migrating to the cucumber 10.3.1 version.It is showing below error. But, the below issue is not occurring if i try with cucumber version 9.3.0.
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/test/Documents/Workspace/miscellaneous/router/src/helper/report/allureReport.ts
at new NodeError (node:internal/errors:405:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
at defaultGetFormat (node:internal/modules/esm/get_format:124:36)
at defaultLoad (node:internal/modules/esm/load:84:20)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:603:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
//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
package.json
To Reproduce Steps to reproduce the behavior:
- Migrate cucumber version to latest 10.3.1
- 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: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
Hey there! Will'll update the integration to make in compatible with the latest versions as soon as it is possible. Stay in touch!
is it fixed?
fixed in 3.0.0-beta.5
➜ t1 git:(master) ✗ USE_ALLURE=true pnpm run test
> [email protected] test /home/fullstack/tests/t1
> cucumber-js
Error: Failed to import formatter ./allure-reporter.ts
at importCode (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/formatter/import_code.ts:14:11)
at async resolveImplementation (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/formatter/resolve_implementation.ts:13:22)
at async initializeFormatter (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/api/formatters.ts:51:28)
at async initializeFormatters (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/api/formatters.ts:84:3)
at async runCucumber (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/api/run_cucumber.ts:93:29)
at async Cli.run (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/cli/index.ts:79:25)
at async Object.run [as default] (/home/fullstack/tests/t1/node_modules/.pnpm/@[email protected]/node_modules/@cucumber/cucumber/src/cli/run.ts:32:14) {
[cause]: TypeError: Unknown file extension ".ts" for /home/fullstack/tests/t1/allure-reporter.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:176:9)
at defaultGetFormat (node:internal/modules/esm/get_format:219:36)
at defaultLoad (node:internal/modules/esm/load:133:22)
at async ModuleLoader.load (node:internal/modules/esm/loader:570:7)
at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:445:45)
at async ModuleJob._link (node:internal/modules/esm/module_job:106:19) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
}
ELIFECYCLE Test failed. See above for more details.
➜ t1 git:(master) ✗
Back with Cucumber 10.8?
cucumber-playwright#readme",
"dependencies": {
"@cucumber/cucumber": "^10.8.0",
"@cucumber/html-formatter": "^21.4.0",
"@cucumber/messages": "^25.0.1",
"@cucumber/pretty-formatter": "^1.0.1",
"@playwright/test": "^1.45.1",
"@types/fs-extra": "11.0.1",
"allure-commandline": "^2.29.0",
"allure-cucumberjs": "3.0.0-beta.6",
"allure-js-commons": "3.0.0-beta.6",
@baev @fullstackwebdev This issue is still persisting