Recently in my Cypress project with TypeScript support utilizing the Cucumber Preprocessor, an unexpected exception has started appearing:
TypeError: Cannot read properties of undefined (reading 'uid')
There are instances where changing to a different workspace resolves the issue temporarily. However, the error persists when opening the Cypress runner or executing tests in Jenkins.
Cypress Runner: (v8.4.0)
https://i.stack.imgur.com/D0GuT.png
Jenkins Console: (v8.7.0)
An error was encountered when invoking the function exported by the plugins file at `C:\Jenkins\workspace\ABC\cypress\plugins\index.js`.
TypeError: Cannot read properties of undefined (reading 'uid')
<error trace here>
error Command failed with exit code 1.
plugins/index.js
const resolve = require('resolve');
const cucumber = require("cypress-cucumber-preprocessor").default;
const cypressBrowserify = require("@cypress/browserify-preprocessor");
...
support/index.ts
import './commands';
import '@shelex/cypress-allure-plugin/reporter';
import 'cypress-xpath';
import 'cypress-plugin-tab';
Cypress.on('uncaught:exception', (err, runnable) => {
cy.log(`Uncaught Exception: ${JSON.stringify(err)}`);
return false;
});