Bhrth
Bhrth

Reputation: 1

Dynamic require of 'https' is not supported error while generating cypress cucumber report in v 10

✘ [ERROR] Could not resolve "https"

node_modules/@ng-apimock/cypress-plugin/dist/cypress.plugin.js:4:22:
  4 │ const https = require("https");
    ╵                       ~~~~~~~

The package "https" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Oops...we found an error preparing this test file:

cypress/support/e2e.js

I'm trying to generate a cypress cucumber report after migrating to cypress version 10 but cypress is throwing the above error and not able to run the tests

Upvotes: 0

Views: 110

Answers (1)

Jay Gould
Jay Gould

Reputation: 179

You can fix this error by upgrading to the latest version of @ng-apimock/cypress-plugin, version 3.0.0.

This current version no longer uses https module, see the code here

import { Configuration } from '@ng-apimock/base-client';
import urljoin = require('url-join');
import * as uuid from 'uuid';

import { RequestObject } from './request.object';

/** Cypress plugin for ng-apimock. */
export class CypressPlugin {
  ...

The diff of the change is here

enter image description here

Also make sure the package "@ng-apimock/core": "3.6.1" is installed, as obviously the Cypress plugin is depending on that library to work.

Then also check the following package versions:

    "@badeball/cypress-cucumber-preprocessor": "15.1.1",
    "@bahmutov/cypress-esbuild-preprocessor": "2.1.5",

Upvotes: 5

Related Questions