4

I'm using cypress 9.3.1 with @cypress/code-coverage 3.9.12 and cypress-cucumber-preprocessor 4.3.1 in an angular 13.0.1 application.

My tests are running fine and also the code coverage is collected, but in the afterAll hook I get an error TypeError: elm[aelFn] is not a function. I have no idea where it is coming from.

I am using ngx-build-plus 13.0.1 to serve the angular app with an extraWebpackConf, but even if I use the 'regular' @angular-devkit/build-angular:dev-server the error message appears at the end of my tests (the code is not instrumented then).

My plugin/index.ts:

const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const path = require('path');

export default (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): Cypress.PluginConfigOptions => {
  // code coverage plugin
  require('@cypress/code-coverage/task')(on, config);

  // cucumber plugin
  const options = {
    ...browserify.defaultOptions,
    typescript: path.resolve('node_modules/typescript'),
  };

  on('file:preprocessor', cucumber(options));

  return config;
};

You can see a screenshot of the error below:

[elm[aelFn] is not a function1

EDIT: even when I remove the cypress code coverage plugin the error still occurs.

lando
  • 335
  • 1
  • 16

1 Answers1

0

I can't fix the issue, but when I catch the error it shows me less error messages at least

Cypress.on('uncaught:exception', (e) => {
  if (e.message.includes('elm[aelFn] is not a function')) {
    // we expected this error, so let's ignore it
    // and let the test continue
    return false;
  }
  // on any other error message the test fails
});
lando
  • 335
  • 1
  • 16