question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Class constructor CucumberJSAllureFormatter cannot be invoked without 'new'

See original GitHub issue

It’s working for typescript configuration but not for Java script config. Same issue when you use versions:

    "cucumber": "5.1.0",
    "allure-cucumberjs": "2.0.0-beta.4",

Next Configuration

var CucumberJSAllureFormatter = require('allure-cucumberjs').CucumberJSAllureFormatter;
var AllureRuntime = require('allure-cucumberjs').AllureRuntime;

function Reporter(options) {
  CucumberJSAllureFormatter.call(this,
    options,
    new AllureRuntime({ resultsDir: "./out/allure-results" }),
    {});
}
Reporter.prototype = Object.create(CucumberJSAllureFormatter.prototype);
Reporter.prototype.constructor = Reporter;

exports.default = Reporter;
TypeError: Class constructor CucumberJSAllureFormatter cannot be invoked without 'new'
    at new Reporter (C:\Users\fescobar\Documents\git\cross-automation\allure-report.js:5:29)
    at Function.build (C:\Users\fescobar\Documents\git\cross-automation\node_modules\cucumber\lib\formatter\builder.js:49:12)
    at C:\Users\fescobar\Documents\git\cross-automation\node_modules\cucumber\lib\cli\index.js:121:35
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\fescobar\Documents\git\cross-automation\node_modules\cucumber\lib\cli\index.js:44:103)
    at _next (C:\Users\fescobar\Documents\git\cross-automation\node_modules\cucumber\lib\cli\index.js:46:194)

Related issue: https://github.com/korobochka/cucumberjs-allure2-reporter/issues/4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sseliverstovcommented, Aug 22, 2020

this one right

var CucumberJSAllureFormatter = require("allure-cucumberjs").CucumberJSAllureFormatter;
var AllureRuntime = require("allure-cucumberjs").AllureRuntime;

function Reporter(options) {
  return new CucumberJSAllureFormatter(
    options,
    new AllureRuntime({ resultsDir: "./allure-results" }),
    {}
  );
}

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

exports.default = Reporter;

see README.md

0reactions
aozolincommented, Jun 4, 2020

I can still see the issue, it’s preventing me to update to “cucumber”: “^6.0.5” Could you let me know when you expect to fix this please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Class constructor model cannot be invoked without ...
When I run my app, an error appears: TypeError: Class constructor model cannot be invoked without 'new' at line 17 which is the...
Read more >
Solved: TypeError: Class constructor Recenter cannot be in...
Solved: Hi, I'm following this "Custom Widget" sample from.
Read more >
Class constructor Class cannot be invoked without 'new'
I'm getting the following error in the console of the browser, when trying to access my route “login”: Uncaught (in promise) TypeError: ...
Read more >
Jest fails with 'Class constructor Spec cannot be invoked ...
TypeError : Class constructor Spec cannot be invoked without 'new' 85 | function createdPatchedSpec(OriginalSpec, registry) { 86 | function ...
Read more >
TypeError: Class constructor HTMLElement cannot be invoked ...
TypeError : Class constructor HTMLElement cannot be invoked without 'new' · 1) Install custom elements es5 adapter for your project. npm i custom- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found