Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when invoking doesFeatureMatch in the support file after v15 release #1025

Closed
3 tasks done
apehead opened this issue May 29, 2023 · 3 comments
Closed
3 tasks done

Comments

@apehead
Copy link

apehead commented May 29, 2023

Current behavior

When using the isFeature and doesFeatureMatch functions, as explained in the documentation found at this link, within the support file (e.g., cypress/support/e2e.js) like this:

import {
  isFeature,
  doesFeatureMatch
} from '@badeball/cypress-cucumber-preprocessor';

beforeEach(() => {
  // This is only run for Cucumber-type specs
  if (isFeature() && doesFeatureMatch('@log')) {
    console.log('*** LOG ***');
  }
});

The following error is observed:

Expected to find internal properties, but didn't. This is likely because you're calling doesFeatureMatch() in a non-feature spec. Use doesFeatureMatch() in combination with isFeature() if you have both feature and non-feature specs (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)

Because this error occurred during a before each hook we are skipping all of the remaining tests.

cypress-cucumber-issue

Desired behavior

Using the isFeature and doesFeatureMatch functions in the support file (e.g., cypress/support/e2e.js), as in the following example, should not result in an error:

import {
  isFeature,
  doesFeatureMatch
} from '@badeball/cypress-cucumber-preprocessor';

beforeEach(() => {
  // This is only run for Cucumber-type specs
  if (isFeature() && doesFeatureMatch('@log')) {
    console.log('*** LOG ***');
  }
});

Test code to reproduce

https://github.com/apehead/issue-cypress-cucumber-preprocessor

Versions

  • Cypress version: v12 (also verified the same behavior in v10 and v11)
  • Preprocessor version: v17 (also verified the same behavior in v15 and v16)
  • Node version: v18 (also verified the same behavior in v16)

Checklist

  • I've read the FAQ.
  • I've read instructions for logging issues.
  • I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).
@apehead
Copy link
Author

apehead commented May 29, 2023

Hi @badeball! Thank you for maintaining this project 🙏

If you need more information about the issue, please let me know.
I've tested different versions of the preprocessor, Cypress, and Node.js as described above. I'm not sure if I missed something or if the behavior before v15 was intentional.

Either way, I'm happy to help if needed.

I want to mention that I have tested the combination of preprocessor v14 with Cypress v12 and it works as expected, although the support for Cypress v12 was introduced in v15.
I hope this information is helpful for troubleshooting the issue.

badeball added a commit that referenced this issue Jun 2, 2023
This feature broke during 084897f of #908 [1].

This patch fixes #1025 [2].

[1] #908
[2] #1025
badeball added a commit that referenced this issue Jun 2, 2023
This feature broke during 084897f of #908 [1].

This patch fixes #1025 [2].

[1] #908
[2] #1025
@badeball
Copy link
Owner

badeball commented Jun 2, 2023

Hi @apehead, thanks for reporting this issue. I've fixed this with v17.2.1.

@apehead
Copy link
Author

apehead commented Jun 2, 2023

Thanks for fixing this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants