allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

allure-cucumber-js - other formatter are override while allure is enabled in config

Open MichalFidor opened this issue 5 years ago • 1 comments

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

I've got a package which formats the logs during test execution (cucumber-pretty). Now, while I provide Allure reporter to cucumberOpts.format together with cucumber-pretty, the 2nd one doesn't want to work.

My config file:

import { browser, Config } from 'protractor';

export const config: Config = {
  SELENIUM_PROMISE_MANAGER: false,
  allScriptsTimeout: 11000,
  directConnect: true,
  restartBrowserBetweenTests: false,

  cucumberOpts: {
    compiler: 'ts:ts-node/register',
    format: [
        'json:results/results.json',
        'node_modules/cucumber-pretty',
        'reporter/reporter.ts',
        'rerun:@rerun.txt',
    ],
    require: ['../e2e/steps/*.ts', '../e2e/support/*.ts', '../support/*.ts'],
    strict: true,
    tags: '',
  },
  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),
  specs: ['../e2e/features/**/*.feature'],
...
};

'reporter/reporter.ts' is a file with class Reporter for CucumberJSAllureFormatter

What is the expected behavior?

It should be able to add also other formatter for the log file.

Please tell us about your environment:

Allure version 2.7.0
Test framework protractor-cucumber-framework
Allure adaptor allure-cucumberjs @2.0.0-beta.6
Generate report using ssh allure generate...

MichalFidor avatar Jan 30 '20 12:01 MichalFidor

As far as I know, cucumber does not allow two reporters to point to the same output location (file, or stdout if file name is not provided). In your case both reporter and cucumber-pretty are set to write to stdout. Fix should be simple, just provide some file name to reporter:

format: [
        'json:results/results.json',
        'node_modules/cucumber-pretty',
        'reporter/reporter.ts:OUTPUT.txt',
        'rerun:@rerun.txt',
    ]

Note the :OUTPUT.txt, name can be any, no actual output is generated by the reporter anyway.

korobochka avatar Feb 24 '20 16:02 korobochka