Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: badeball/cypress-cucumber-preprocessor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v20.1.0
Choose a base ref
...
head repository: badeball/cypress-cucumber-preprocessor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v20.1.1
Choose a head ref
  • 12 commits
  • 6 files changed
  • 2 contributors

Commits on Jun 27, 2024

  1. Update FAQ with correct error message

    badeball committed Jun 27, 2024
    Copy the full SHA
    f4ec6a4 View commit details
  2. Correct anchor

    badeball committed Jun 27, 2024
    Copy the full SHA
    7076bd8 View commit details

Commits on Jun 30, 2024

  1. Add cypress-mochawesome-reporter to event handler examples

    badeball authored Jun 30, 2024
    Copy the full SHA
    6d85754 View commit details

Commits on Jul 5, 2024

  1. Use vscode-markdown to maintain TOC in FAQ

    This will hopefully prevent issues such as 7076bd8.
    badeball committed Jul 5, 2024
    Copy the full SHA
    be36584 View commit details
  2. Avoid specifying different node version requirements

    While it's true that reports / pretty output might be that which
    increases the version requirement from 14 to 18 - this is still subject
    to change at anytime and not verified & tested in any way.
    badeball committed Jul 5, 2024
    Copy the full SHA
    bdd8009 View commit details
  3. Reword and specify

    badeball committed Jul 5, 2024
    Copy the full SHA
    82e1667 View commit details
  4. Add a section about webpack configuration error

    This comes up from time to time.
    badeball committed Jul 5, 2024
    Copy the full SHA
    5534493 View commit details

Commits on Jul 6, 2024

  1. Copy the full SHA
    27b790d View commit details
  2. Comment on mixing

    badeball committed Jul 6, 2024
    Copy the full SHA
    fa2b9b7 View commit details

Commits on Jul 21, 2024

  1. Add BrowserStack attribution

    This is necessary to gain open source access.
    badeball committed Jul 21, 2024
    Copy the full SHA
    85c77e3 View commit details

Commits on Jul 23, 2024

  1. Omit outputting empty "then" entries to the command log

    Relates to #1214 [1].
    
    This is unfortunately highly dependant on Cypress' implementation
    details and cumbersome (at best) to test. Hopefully this doesn't have
    any adverse side effects.
    
    [1] #1214
    badeball committed Jul 23, 2024
    Copy the full SHA
    5a42588 View commit details

Commits on Jul 27, 2024

  1. v20.1.1

    badeball committed Jul 27, 2024
    Copy the full SHA
    9d2e562 View commit details
Showing with 62 additions and 27 deletions.
  1. +4 −0 CHANGELOG.md
  2. +2 −0 README.md
  3. +2 −0 docs/event-handlers.md
  4. +51 −24 docs/faq.md
  5. +2 −2 lib/helpers/cypress.ts
  6. +1 −1 package.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## v20.1.1

- Omit outputting empty "then" entries to the command log, relates to [#1214](https://github.com/badeball/cypress-cucumber-preprocessor/discussions/1214).

## v20.1.0

- Include skipped (not omitted) tests in reports, fixes [#1041](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1041).
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -77,3 +77,5 @@ $ npm run test # runs all of the above
## Attribution

A special thanks goes out to [Łukasz Gandecki](https://github.com/lgandecki) for developing and maintaning the cypress-cucumber integration before me, in addition to [all other contributors](https://github.com/badeball/cypress-cucumber-preprocessor/graphs/contributors). Some of the work has partially been sponsored by [Klaveness Digital](https://www.klavenessdigital.com/).

This project is tested with BrowserStack.
2 changes: 2 additions & 0 deletions docs/event-handlers.md
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ The following plugins (non-exhaustive) are known to also define event handlers.
- [cypress-testrail][cypress-testrail]
- [cypress-xray-plugin][cypress-xray-plugin]
- [cypress-split][cypress-split]
- [cypress-mochawesome-reporter][cypress-mochawesome-reporter]

If you use any of these plugins, then you need to consider [cypress-on-fix][cypress-on-fix], otherwise your mileage may vary.

@@ -114,3 +115,4 @@ export default defineConfig({
[cypress-xray-plugin]: https://github.com/Qytera-Gmbh/cypress-xray-plugin
[cypress-on-fix]: https://github.com/bahmutov/cypress-on-fix
[cypress-split]: https://github.com/bahmutov/cypress-split
[cypress-mochawesome-reporter]: https://github.com/LironEr/cypress-mochawesome-reporter
75 changes: 51 additions & 24 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
[← Back to documentation](readme.md)

# Frequently asked questions

* Node requirements
* [I get `fs_1.promises.rm is not a function`](#i-get-fs_1promisesrm-is-not-a-function)
* [I get `state.messages.findLastIndex is not a function`](#i-get-statemessagesfindlastindex-is-not-a-function)
* Cypress oddities
* [`--env` / `tags` isn't picked up](#--env--tags-isnt-picked-up)
* [Negated tags / complex tag expressions aren't working as expected](#negated-tags--complex-tag-expressions-arent-working-as-expected)
* [JSON reports aren't generated in open / interactive mode](#json-reports-arent-generated-in-open--interactive-mode)
* TypeScript related
* [I get `cypress_esbuild_preprocessor_1.createBundler is not a function`](#i-get-cypress_esbuild_preprocessor_1createbundler-is-not-a-function)
* [I get `cypress_esbuild_preprocessor_1.default is not a function`](#i-get-cypress_esbuild_preprocessor_1default-is-not-a-function)
* [I get `Cannot find module '@badeball/cypress-cucumber-preprocessor/esbuild'`](#i-get-cannot-find-module-badeballcypress-cucumber-preprocessoresbuild)
* On event handlers
* [My JSON report isn't generated](#my-json-report-isnt-generated)
* [I get `Unexpected state in <state-handler>: <state>`](#i-get-unexpected-state-in-state-handler-state)
* Feature deprecations
* [Why is `cypress-tags` missing?](#why-is-cypress-tags-missing)
* [The members `And(..)` and `But(..)` are missing](#function-members-and-and-but-are-missing)
# Frequently asked questions <!-- omit from toc -->

- [I get `fs_1.promises.rm is not a function`](#i-get-fs_1promisesrm-is-not-a-function)
- [I get `state.messages.current.findLastIndex is not a function`](#i-get-statemessagescurrentfindlastindex-is-not-a-function)
- [`--env` / `tags` isn't picked up](#--env--tags-isnt-picked-up)
- [Negated tags / complex tag expressions aren't working as expected on Windows](#negated-tags--complex-tag-expressions-arent-working-as-expected-on-windows)
- [JSON reports aren't generated in open / interactive mode](#json-reports-arent-generated-in-open--interactive-mode)
- [I get `cypress_esbuild_preprocessor_1.createBundler is not a function`](#i-get-cypress_esbuild_preprocessor_1createbundler-is-not-a-function)
- [I get `cypress_esbuild_preprocessor_1.default is not a function`](#i-get-cypress_esbuild_preprocessor_1default-is-not-a-function)
- [I get `Cannot find module '@badeball/cypress-cucumber-preprocessor/esbuild'`](#i-get-cannot-find-module-badeballcypress-cucumber-preprocessoresbuild)
- [My JSON report isn't generated in run mode](#my-json-report-isnt-generated-in-run-mode)
- [I get `Unexpected state in <state-handler>: <state>`](#i-get-unexpected-state-in-state-handler-state)
- [I get `Webpack Compilation Error` (shown below)](#i-get-webpack-compilation-error-shown-below)
- [Why is `cypress-tags` missing?](#why-is-cypress-tags-missing)
- [Function members `And(..)` and `But(..)` are missing](#function-members-and-and-but-are-missing)
- [Which preprocessor version should I choose?](#which-preprocessor-version-should-i-choose)

<!-- Node requirements -->

## I get `fs_1.promises.rm is not a function`

Upgrade your node version to at least [v14.14.0](https://nodejs.org/api/fs.html#fspromisesrmpath-options).
Upgrade your node version to v18.0.0, which is the minimum required version.

## I get `state.messages.findLastIndex is not a function`
## I get `state.messages.current.findLastIndex is not a function`

Upgrade your node version to at least [v18.0.0](https://nodejs.org/en/blog/announcements/v18-release-announce#v8-101). This only applies to users of any kind of reports (messages, json and html).
Upgrade your node version to v18.0.0, which is the minimum required version.

<!-- Cypress oddities -->

## `--env` / `tags` isn't picked up

This might be because you're trying to specify `-e / --env` multiple times, but [multiple values should be comma-separated](https://docs.cypress.io/guides/guides/command-line#cypress-run-env-lt-env-gt).

## Negated tags / complex tag expressions aren't working as expected
## Negated tags / complex tag expressions aren't working as expected on Windows

Windows / CMD.EXE users must be aware that single-quotes bear no special meaning and should not be used to group words in your shell. For these users, only double-quotes should be used for this purpose. What this means is that, for these users, running `cypress run --env tags='not @foo'` <ins>is not going to behave</ins> and double-quotes must be used. Furthermore, similar scripts contained in `package.json` should also use double-quotes (escaped necessarily, as that is JSON).

## JSON reports aren't generated in open / interactive mode

JSON reports aren't generated in open / interactive mode. They rely on some events that aren't available in open-mode, at least not without `experimentalInteractiveRunEvents: true`. However, this experimental flag broke some time ago, ref. [cypress-io/cypress#18955](https://github.com/cypress-io/cypress/issues/18955), [cypress-io/cypress#26634](https://github.com/cypress-io/cypress/issues/26634). There's unfortunately little indication that these issues will be fixed and meanwhile reports will not be available in open / interactive mode.

<!-- TypeScript related -->

## I get `cypress_esbuild_preprocessor_1.createBundler is not a function`

This can happen if you have a TypeScript Cypress configuration (IE. `cypress.config.ts` as opposed to `cypress.config.js`) similar to one of our examples and have a `tsconfig.json` _without_ `{ "compilerOptions": { "esModuleInterop": true } }`.
@@ -76,14 +79,32 @@ Set `compilerOptions.moduleResolution` to `node16` in your `tsconfig.json`. User
}
```

## My JSON report isn't generated
<!-- On event handlers -->

## My JSON report isn't generated in run mode

You may have stumbled upon a configuration caveat (see [docs/configuration.md: Caveats / Debugging](configuration.md#caveats--debugging)) or are overriding some of the plugin's own event handlers (see [docs/event-handlers.md: On event handlers](https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/event-handlers.md)).

## I get `Unexpected state in <state-handler>: <state>`

You might be overriding some of the plugin's own event handlers (see [docs/event-handlers.md: On event handlers](https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/event-handlers.md)).

<!-- Configuration issues -->

## I get `Webpack Compilation Error` (shown below)

```
Error: Webpack Compilation Error
Module parse failed: Unexpected token (2:21)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
```

This virtually always means that you have misconfigured `@cypress/webpack-preprocessor`. [Here's](https://github.com/badeball/cypress-cucumber-preprocessor/blob/v20.1.0/examples/webpack-cjs/cypress.config.js#L20-L28) an example of the crucial configuration value, for which when missing generates the error above.

This is usually seen when users are diverging from the [examples](https://github.com/badeball/cypress-cucumber-preprocessor/tree/master/examples) by EG. placing preprocessor configuration in `cypress/plugins/index.js` (which some blog posts reference despite this being deprecated) or by placing webpack-specific content in `webpack.config.js` (or similar) and *not* referencing this file in `cypress.config.js`.

<!-- Feature deprecations -->

## Why is `cypress-tags` missing?

The `cypress-tags` executable has been removed and made redundant. Specs containing no matching scenarios are [automatically filtered](https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/tags.md#running-a-subset-of-scenarios), provided that `filterSpecs` is set to true.
@@ -93,3 +114,9 @@ The `cypress-tags` executable has been removed and made redundant. Specs contain
These have been [deprecated](https://github.com/badeball/cypress-cucumber-preprocessor/issues/821) to reflect cucumber-js' behavior. You can still however use the `And` keyword in `.feature` files. As explained on [SO](https://stackoverflow.com/questions/24747464/how-to-use-and-in-a-gherkin-using-cucumber-js#comment38690100_24748612),

> `And` is only used in scenarios, not as step definition methods. Semantically it means "same keyword as in previous step"; technically it is just another step. In fact, you can use `Given()`, `When()` and `Then()` interchangeably in your step definitions, Cucumber will not enforce a match between the step keyword and the step definition function.
## Which preprocessor version should I choose?

The observant reader might have noticed that there's a NPM package named `cypress-cucumber-preprocessor` and `@badeball/cypress-cucumber-preprocessor`. This is merely a result of maintainer and ownership transfer. The package `cypress-cucumber-preprocessor` is severely outdated by now and as far as I (the current maintainer) knows, there's no reason to be using it.

In any case, chose one over the other and don't attempt to mix these, essentially different packages, in the same project.
4 changes: 2 additions & 2 deletions lib/helpers/cypress.ts
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ export function runStepWithLogGroup(options: {
argument?: DataTable | string;
text?: string;
}) {
Cypress.log({
const log = Cypress.log({
name: options.keyword,
message: options.text == null ? "" : `**${options.text}**`,
groupStart: true,
@@ -71,7 +71,7 @@ export function runStepWithLogGroup(options: {
}

return ensureChain(ret).then((result) => {
Cypress.log({ groupEnd: true, emitOnly: true } as object);
(log as any).endGroup();
return result;
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@badeball/cypress-cucumber-preprocessor",
"version": "20.1.0",
"version": "20.1.1",
"author": "Jonas Amundsen",
"license": "MIT",
"homepage": "https://github.com/badeball/cypress-cucumber-preprocessor",