infosum / cypress-tags

Use custom tags to slice up Cypress test runs
83 stars 20 forks source link

Export Tagify Function Not Properly Working #211

Closed DPC15038 closed 2 years ago

DPC15038 commented 2 years ago

The PR that was merged yesterday appears to introduce an issue. Whenever I run that code, I get the error

TypeError: cypress_tags_1.tagify is not a function

I was able to fix it by reverting the change in cypress.config.ts from on('file:preprocessor', () => tagify(config)); back to on('file:preprocessor', tagify(config));

Also, I had to change the index.ts file within this repo from

preprocessor.transform = transform;

export { preprocessor as tagify };

module.exports = preprocessor;

to this

export { preprocessor as tagify };
LennonReid commented 2 years ago

Same problem here.

annaet commented 2 years ago

I'll take a look at this today 👍

annaet commented 2 years ago

Just released v1.0.2 which should hopefully fix your issue. I'll leave this ticket open until you can verify the fix.

DPC15038 commented 2 years ago

Reviewed your PR, and it looks good to me. Thanks for fixing this 👍

I'd say you can close this ticket as completed.

annaet commented 2 years ago

Brilliant thanks.

zaq42 commented 2 years ago

This is a breaking change for me.

Running cypress-tags:1.0.2 in BitBucket Pipelines on cypress-included:10.7.0

The error was thrown while executing your e2e.setupNodeEvents() function:
TypeError: tagify is not a function
    at module.exports (/opt/atlassian/pipelines/agent/build/tests/cypress/plugins/index.js:13:27)
    at setupNodeEvents (/opt/atlassian/pipelines/agent/build/tests/cypress.config.ts:38:51)
    at /root/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:118:14
    ...

I've rolled back to cypress-tags:1.0.0

annaet commented 2 years ago

@zaq42 Apologies I think it's because I switched from a default export to a named export. It should have been a major change rather than a patch.

I imagine you have something like

const tagify = require('cypress-tags');

as your import currently?

If you switch it to

const { tagify } = require('cypress-tags');

then it should work with 1.0.2 as expected.

zaq42 commented 2 years ago

@annaet Thanks for the prompt response, and apologies for the delay at my end. (I thought I'd get a notification from github)

You are right. After making the precise change that you recommended, all is good again.

Thank you!