UNPKG

@serenity-js/cucumber

Version:

Serenity/JS test runner adapter for seamless integration with any version of Cucumber.js, facilitating BDD-style test automation and leveraging Serenity/JS reporting capabilities

28 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TempFileOutputDescriptor = void 0; /* eslint-disable unicorn/prevent-abbreviations */ const io_1 = require("@serenity-js/core/lib/io"); /** * Cucumber.js allows [max 1 formatter per output](https://github.com/cucumber/cucumber-js/blob/625fab034eea768bf74f7a46993a57182204ddf6/src/cli/index.ts#L83-L140) * and doesn't allow writing to \\.\NUL on Windows (equivalent of *nix /dev/null) because of the [check in OptionSplitter](https://github.com/cucumber/cucumber-js/blob/625fab034eea768bf74f7a46993a57182204ddf6/src/cli/option_splitter.ts#L3) * so instead I create a dummy temp file, which is deleted when the test run is finished. * * @group Integration */ class TempFileOutputDescriptor { fileSystem; path; constructor(fileSystem) { this.fileSystem = fileSystem; this.path = this.fileSystem.temporaryDirectory('serenity-').join(io_1.Path.from('output.tmp')); } value() { return this.path.value; } cleanUp() { return this.fileSystem.remove(this.path); } } exports.TempFileOutputDescriptor = TempFileOutputDescriptor; //# sourceMappingURL=TempFileOutputDescriptor.js.map