Skip to content

Using -parallel and redirecting stdout / logging #2542

@AndrejMitrovic

Description

@AndrejMitrovic

Hi,

Is there a way to set console / stdout redirects for each cucumber worker when running with the -parallel switch?

I have a project where parallelism is implemented via a shell script that spawns multiple cucumber processes, each redirecting stdout / stderr to its own file.

This works nicely. But this limits parallelism on the feature file level.

I'd like to utilize scenario-level parallelism. -parallelism is perfect for that and it works great. I can route any console logging of the process itself to a specific file. But I can't seem to hook into cucumber to do the same. So Gherkin steps are still shown interleaved.

Essentially I set up a logger such as winston, and simply redirect the console:

const logger = winston.createLogger(...)

console.log = (message) => {
    logger.info(message);
};

console.info = (message) => {
    logger.info(message);
};

...

Works great for the process, but Cucumber itself likely writes directly to stdout, which I'm not touching here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions