Migrating Cypress test from old version to latest version throws error Expected to find a global registry
See original GitHub issueCurrent behavior
I am trying to migrate my existing Cypress BDD tests from 8.7.0 version to latest version 10.10.0. I have installed the required libraries and amended the settings. I was having an old node version 12 + version, now updated to node v18.4.0 and tried again. Couldn’t find any pointers to resolve similar issue, so any advise would be really helpful.
Following is my automation folder structure:
- ** feature file location**
tests/cypress/e2e/ login/login.feature
- ** Step definition location**
Imported in the step definition file
import { Given, When, Then, Before, After} from "@badeball/cypress-cucumber-preprocessor";
tests/cypress/stepDefinitions/login.cy.js
Added e2e.js
file under tests/cypress/support folder:
// Import commands.js using ES2015 syntax:
import './commands'
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
Added .cypress-cucumber-preprocessorrc.json
file in to the test root folder
{
"stepDefinitions": [
"[filepath].{js,ts}",
"tests/cypress/stepDefinitions/**/*.{js,ts}",
"tests/cypress/e2e/[filepath]/**/*.{js,ts}",
"tests/cypress/e2e/[filepath].{js,ts}",
"tests/cypress/support/step_definitions/**/*.{js,ts}"
]
}
Below is my cypress.config.js file:
const { defineConfig } = require("cypress");
const webpackPreprocessor = require('@cypress/webpack-preprocessor');
const addCucumberPreprocessorPlugin = require("@badeball/cypress-cucumber-preprocessor");
const dotenvPlugin = require("cypress-dotenv");
async function setupNodeEvents(on, config) {
await addCucumberPreprocessorPlugin.addCucumberPreprocessorPlugin(on, config);
const options = {
webpackOptions: {
module: {
rules: [
{
test: /\.feature$/,
use: [
{
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
options: config,
},
],
},
],
},
},
};
on('file:preprocessor', webpackPreprocessor(options));
return config;
}
module.exports = {
default: defineConfig({
e2e: {
baseUrl: "https://book.test.co",
specPattern: "tests/cypress/e2e/**/*.feature",
supportFile: false,
setupNodeEvents,
},
}),
setupNodeEvents,
};
Error Details
Desired behavior
Hope to run the BDD feature file without errors
Test code to reproduce
Removed following items from the automation framework
- **plugin/index.js ** file
- **cypress.json ** file
uninstalled old
cypress-cucumber-preprocessor
from the project
Versions
- Cypress version: Cypress 10.10.0
- Preprocessor version: @badeball/cypress-cucumber-preprocessor 11.4.0
- Node version: v18.4.0
- cypress/webpack-preprocessor: 5.14.0
- OS: Ubuntu 20.04.3 LTS
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).
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
node.js - Migrating cypress test from old version to latest ...
Migrating cypress test from old version to latest version throws error ... Expected to find a global registry (this usually means you are ......
Read more >Migration Guide | Cypress Documentation
This guide details the changes and how to change your code to migrate to Cypress version 11.0. See the full changelog for version...
Read more >Migrating Test Automation Suite To Cypress 10 - LambdaTest
P.S.: When writing this blog, the latest version of Cypress is 11.2.0. ... When a test fails, an error message is thrown.
Read more >Cypress 10 Upgrade - TestersDock
As you can see above in the After section the file names are not shown as cy.js because the migration helper is not...
Read more >Mocha - the fun, simple, flexible JavaScript test framework
If you use callback-based async tests, Mocha will throw an error if done() is ... In versions older than v3.0.0, the call to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having the same issue with the ‘Expected to find a global registry’ error. I created a minimal setup with cypress and cucumber. Maybe this might help: https://github.com/DenFin/minimal-cypress-cucumber-setup
@scrumvisualize actually removing
js
from thespecPattern
solved the problem for me