Encountering a problem in Cypress when using Typescript in the plugins file. It is necessary to close and restart the application whenever an error occurs

In order to pre-saturate my redux in Cypress tests, I need to dispatch. It works well, but whenever an error occurs or a test fails, I receive the following cryptic message:

Error: ENOENT: no such file or directory, stat '/Users/bill/Library/Application Support/Cypress/cy/production/projects/coresite-69f7195282475693846caddd826bc773/bundles/cypress/support/index.js'

This error occurred while Cypress was compiling and bundling the test code. This usually happens because of:

A missing file or dependency A syntax error in the file or one of its dependencies

To resolve this issue, I have to close my cypress tests and then restart with "npx cypress open". After that, everything works fine.

I believe the problem is related to my addition of the following code in the /plugins/index.js file

const wp = require("@cypress/webpack-preprocessor");

module.exports = (on) => {
    const options = {
      webpackOptions: require('../../webpack.config')({ env: 'development' }),
    };
    on('file:preprocessor', wp(options));
};

Any suggestions on how to fix this? I had to add that plugin because in one of my files, I'm using:

cy.on("emit:reduxStore", async (store) => {
    store.dispatch(actions.updateAreas(data));
});

Answer №1

Encountered a similar problem myself. The culprit turned out to be the CleanWebpackPlugin in use. After removing it from the plugins array, the error disappeared completely. It appears that there was a conflicting interaction between the preprocessor and the plugin.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

RxJS: Transforming an Observable array prior to subscribing

I am retrieving data (students through getStudents()) from an API that returns an Observable. Within this result, I need to obtain data from two different tables and merge the information. Below are my simplified interfaces: export interface student Stude ...

Stop images from constantly refreshing upon each change of state - React

Within my component, I have incorporated an image in the following way: <div className="margin-10 flex-row-center"> <span> <img src={spinner} className="spinner" /> ...

It is possible that req.user may be undefined, especially when using express and passport.js

I am facing an issue with my Node.js TypeScript authentication system that utilizes passport. The problem arises when I attempt to access req.user in a specific route, resulting in the error message: Object is possibly 'undefined'. This behavio ...

Make sure to call super.onDestroy() in the child component before overriding it

I find myself with a collection of components that share similar lifecycle logic, so I decided to create a base component that implements the OnDestroy interface. abstract class BaseComponent implements OnDestroy { subscriptions = new Array<Subscript ...

Error with Angular 2 observables in TypeScript

When a user types a search string into an input field, I want to implement a debounce feature that waits for at least 300 milliseconds before making a request to the _heroService using HTTP. Only modified search values should be sent to the service (distin ...

Mastering the art of utilizing async await efficiently

Currently, I am trying to save/update data in my Firestore document. I have successfully implemented this without any issues by using an async function. However, I must admit that I am not very familiar with async functions or promises. I have provided my ...

Best practices for declaring props with custom types in Nuxt 3 using TypeScript to handle possible undefined values

Exploring the use of TypeScript in a Nuxt3 project for the first time has been quite an experience. One specific component in the project is focused on either creating or editing a person in the backend: <template> <UCard> <template # ...

Interacting with a Web Socket Connection While Editing Inline Content Causes Distractions. Using Angular 9 Material Table

Not exactly an error-related inquiry, but more about behaviors. In my Angular 9 setup using RxJS and Material, I have a table connected to a web socket for updates triggered by blur or change, depending on the column. This setup works well, updating the ta ...

Guide on tracking the cursor using Angular

Recently, I developed a basic application in Angular that incorporates animations. You can check out the StackBlitz here to see it in action. The app features states that we can switch to control where an eye is looking. Currently, I am looking for a way ...

The npm warning indicates that the file node_modules/.staging/typescript-8be04997/lib/zh-CN/diagnosticMessages.generated.json does not exist due to an ENOENT error

I am currently in the process of running npm install on a Linux machine where I do not have sudo access. Unfortunately, I have a machine-specific package.json and package-lock.json that cannot be changed. However, I encountered some errors during the insta ...

Acquire keys from a different residence

Currently, I am working on a React component that accepts data through props and I aim to implement safe property access. I have experimented with the following: type Props = { items?: any[]; // uncertain about using type "any" bindValue?: keyof Prop ...

What could be causing my function to not provide the expected output?

Whenever I try to invoke the function from another part of the code, I encounter an issue where it returns undefined before actually executing the function. The function is stored in a service. login.page.ts: ngOnInit(){ console.log(this.auth.getRole()) ...

What is the best way to test an oclif CLI tool that interacts with a Rest API

How can I efficiently test the TypeScript code I've written for an Oclif CLI that interacts with a Node.js and Express.js REST API? I'm currently using Mocha/Chai for testing, but I'm struggling with testing the specific command code from my ...

What factors contribute to TypeScript having varying generic function inference behaviors between arrow functions and regular functions?

Consider the TypeScript example below: function test<T = unknown>(options: { a: (c: T) => void, b: () => T }) {} test({ a: (c) => { c }, // c is number b: () => 123 }) test({ b: () => 123, a: (c) => { retur ...

Encountered issue when attempting to insert items into the list in EventInput array within FullCalendar and Angular

I am struggling to create a dynamic object that I need to frame and then pass to the FullCalendar event input. Here is my initial object: import { EventInput } from '@fullcalendar/core'; ... events: EventInput[]; this.events = [ { title: &ap ...

Capture a screenshot with Puppeteer at a random URL stop

I am facing an issue with my service nodejs running on Ubuntu, where I use puppeteer to capture screenshots of pages. However, the method page.screenshot({fullPage: true, type: 'jpeg'}) sometimes fails on random URLs without displaying any errors ...

What is the best way to effectively nest components with the Nebular UI Kit?

I'm currently facing an issue with nesting Nebular UI Kit components within my Angular app. Specifically, I am trying to nest a header component inside the home page component. The problem arises when the attributes take up the entire page by default, ...

What is the method for including a placeholder (instead of a label) in the MUI 5 DatePicker component?

I'm looking to customize the placeholder text in MUI 5's date picker. You can find the MUI 5 datepickerlink here: https://mui.com/x/react-date-pickers/date-picker/ The desired outcome:: I've tried referring to this chat, but it hasn't ...

Guide to developing a versatile Icon Wrapper component for FontAwesome Icons in React that adapts to changing needs

I'm looking to develop a customized React Icon-Component where I can simply input the icon name as a string and have the icon display automatically. After following the guidelines provided here: https://fontawesome.com/docs/web/use-with/react/add-ico ...

Iterate through the complex array of nested objects and modify the values according to specified conditions

I am currently iterating through an array of objects and then delving into a deeply nested array of objects to search for a specific ID. Once the ID is found, I need to update the status to a particular value and return the entire updated array. Issue: Th ...