Skip to content

Commit

Permalink
Avoid writing messages implicitly
Browse files Browse the repository at this point in the history
This fixes #1140 [1].

[1] #1140
  • Loading branch information
badeball committed Dec 17, 2023
1 parent acbdd0a commit ec27613
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 113 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Breaking changes:

- This is now easily determined by using other properties, as reflected in the docs.

- Messages reports are no longer implicitly enabled and written to disk when enabling JSON or HTML reports, fixes [#1140](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1140).

Other changes:

- Emit meta information (lib version, node version, os, ci) in meesage reports, fixes [#1133](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1133).
Expand Down
27 changes: 27 additions & 0 deletions features/issues/1140.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# https://github.com/badeball/cypress-cucumber-preprocessor/issues/1140

Feature: no imlicit report
Scenario: JSON enabled
Given additional preprocessor configuration
"""
{
"json": {
"enabled": true
}
}
"""
And a file named "cypress/e2e/a.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given a step
"""
And a file named "cypress/support/step_definitions/steps.js" with:
"""
const { Given } = require("@badeball/cypress-cucumber-preprocessor");
Given("a step", function() {})
"""
When I run cypress
Then it passes
And there should be a JSON output similar to "fixtures/passed-example.json"
And there should be no messages report
10 changes: 10 additions & 0 deletions features/step_definitions/messages_steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ Then(
}
);

Then("there should be no messages report", async function (this: ICustomWorld) {
await assert.rejects(
() => fs.readFile(path.join(this.tmpDir, "cucumber-messages.ndjson")),
{
code: "ENOENT",
},
"Expected there to be no messages report"
);
});

Then("there should be a messages report", async function (this: ICustomWorld) {
await assert.doesNotReject(
() => fs.access(path.join(this.tmpDir, "cucumber-messages.ndjson")),
Expand Down
Loading

0 comments on commit ec27613

Please sign in to comment.