TLDR
Just remove cypress-tags
altogether, but a good enhancement is to add filterSpecs
and omitFiltered
options.
From this page Transfer of ownership
The cypress-tags
has been removed and made redundant. Specs containing no matching scenarios are automatically filtered, provided that filterSpecs
is set to true.
So, if I run
npx cypress run --env tags="@regression"
I get results like
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ √ duckduckgo.feature 0ms - - - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ duckduckgo2.feature 00:04 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
√ All specs passed! 00:04 1 1 - - -
which has done the job (duckduckgo2.feature has the regression tag).
But it's better with these two config options
package.json
{
...
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^11.3.1",
"cypress": "^10.3.0",
},
"cypress-cucumber-preprocessor": {
"filterSpecs": true,
"omitFiltered": true
}
}
I now get
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ √ duckduckgo2.feature 00:04 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
√ All specs passed! 00:04 1 1 - - -
cypress.config.js
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
async function setupNodeEvents(on, config) {
await preprocessor.addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin.default(config)],
})
);
return config;
}
module.exports = defineConfig({
e2e: {
specPattern: "**/*.feature",
supportFile: false,
setupNodeEvents,
},
});
regression
? Is it in your step definition files? – Catabolism