infosum / cypress-tags

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

File preprocessor doesn't work for component tests #257

Open KoenBrouwer opened 1 year ago

KoenBrouwer commented 1 year ago

Hi,

We tried this setup also with component tests, with the following settings:

    component: {
        setupNodeEvents: (on, config) => {
            on("file:preprocessor", tagify(config));
        },
    },

This resulted in the following errors:

> Suite argument "title" must be a string. Received type "object"
> Test argument "title" must be a string. Received type "object"

For those trying to find out why this is not working, please see: https://github.com/cypress-io/cypress/issues/21992#issuecomment-1146034403. The Preprocessor API is only available for E2E-tests, not for component tests.

I just spent an entire afternoon trying to make this work. Hope this helps. 😄

jdvegmond commented 5 months ago

I think this could be solved by adding "types": ["cypress-tags"] to the compilerOptions in tsconfig. ('cypress-tags' should replace 'cypress' if it's present in the 'types' array.)