Comments (20)
Issue-Label Bot is automatically applying the label bug
to this issue, with a confidence of 0.82. Please mark this comment with 👍 or 👎 to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
from cypress-react-selector.
@dmlogs can you share the actual error message or the screenshot?
@nickpalmer may be interested in this as per the recent changes #90
from cypress-react-selector.
@nickpalmer Can you check whether 2.2.1
build really making a noise for the require.resolve
?
from cypress-react-selector.
@abhinaba-ghosh hello, I've been having the same error when I tried to import "cypress-react-selector";
and then do a
beforeEach(() => { cy.waitForReact(); ... });
inside support/index.js
from cypress-react-selector.
@abhinaba-ghosh - sorry, I didn't include because it doesn't provide much additional context to what I put in the ticket, happy to provide additional info as well 👍
from cypress-react-selector.
By looking into this, it seems the problem is really happening for a subset of users. Can be a system configuration issue.
from cypress-react-selector.
Hi, If it helps it's happening to me too, only when running my project on docker
from cypress-react-selector.
Recent PR breaks the selector on MAC and linux, had to go back to version 2.2.0. to fix it.
from cypress-react-selector.
I'm not an expert JS developer so take what I say with a grain of salt
Something like below might work to resolve. Theory on the below is that typeerror only seems to happen from the execution at run time so if it can be bypassed. I would still be hesitant to tap in to the node_modules folder by path name.
const file = require?.resolve && typeof require?.resolve === 'function' ? require.resolve('resq') : 'node_modules/resq/dist/index.js';
Side Note: I've actually moved away from my previous use case for leveraging cypress-react-selector in favor of a simpler mechanism for the behavior I was looking to test that does not require tapping in to the React DOM - otherwise I'd implement and test the above myself, but hopefully someone else can pick it up
from cypress-react-selector.
@abhinaba-ghosh I can confirm it occurs with me too. I'm using Ubuntu 20.01 and Cypress 4.12.0. I had to install V 2.2.0 to solve it.
from cypress-react-selector.
@0xIslamTaha is it also happening with the latest version of cypress-react-selector? Can you confirm?
from cypress-react-selector.
require.resolve was add in node version v0.3.0:
https://nodejs.org/api/modules.html#modules_require_resolve_request_options
The only reason I can think that it would not exist is that you are running on a very old version of node.
That said we have moved away from cypress-react-selector, but the code suggested by @dmlogs above should work in versions of node missing require.resolve.
from cypress-react-selector.
Thanks @nickpalmer and @dmlogs , the suggested code is deployed to v2.3.4
from cypress-react-selector.
require.resolve was add in node version v0.3.0:
https://nodejs.org/api/modules.html#modules_require_resolve_request_optionsThe only reason I can think that it would not exist is that you are running on a very old version of node.
That said we have moved away from cypress-react-selector, but the code suggested by @dmlogs above should work in versions of node missing require.resolve.
@nickpalmer here is my running node
$ node -v
v14.15.1
from cypress-react-selector.
Thanks @nickpalmer and @dmlogs , the suggested code is deployed to
v2.3.4
Thanks man, 2.3.4 is working fine.
from cypress-react-selector.
We don't use typescript but apparently it uses a custom implementation of resolution. Telling it to use Node's version via --moduleResolution node
might fix it but v2.3.4 should work in both situations.
TypeScript's replacement is breaking Node's API contract of offering require.resolve and they really should add a .resolve to their implementation so as not to break the API Node offers.
See:
https://www.typescriptlang.org/docs/handbook/module-resolution.html
from cypress-react-selector.
Issue filed with TypeScript so hopefully they will stop breaking the Node API at some point with their override.
from cypress-react-selector.
Great input @nickpalmer . Thanks for letting us know.
from cypress-react-selector.
The implemented fix breaks my setup with the same syntax problem as #128. I have made this hack to get running (although I could just call require.resolve without testing it since the property does exist).
const file = require.hasOwnProperty('resolve') ? require.resolve('resq') : 'node_modules/resq/dist/index.js';
node v14.15.4, cypress-react-selector v2.3.4, typescript v4.1.3 in my project. On Windows.
from cypress-react-selector.
Hi @gshrimpling67, a patch release is made v.2.3.5
. Let me know if that solves the issue for your case.
from cypress-react-selector.
Related Issues (20)
- Cannot read properties of undefined (reading 'waitToLoadReact') HOT 2
- Would this work with 3rd party libraries? Such as Material UI? HOT 2
- getting webpack-dev-server warning on resqInjector.js attaching the error. HOT 1
- Selectors are failing when upgrading to React 18 HOT 12
- Update plugin to be compatible with Cypress 10 HOT 4
- Could not find instance of React in given element HOT 6
- Functions react() and getReact() don't retry upcoming assertions
- Functions react() and getReact() - infinite retrying for failed upcoming assertions HOT 1
- Is it possible to get a component from a portal?
- No "sourceType" field on TSConfig compiler options HOT 1
- Using getCurrentState
- Cypress 12 Compatibility
- Can't find component by props with value of type array of objects. HOT 1
- Not able to access the sample tests (e2e tests) HOT 1
- incompatibility with Reactjs version 18
- Selector is reporting too many/duplicate items
- How to call the function inside of a component? HOT 1
- Option to suppress cy.log in getProps and getCurrentState
- warning message with resq
- Error when using Vite preprocessor due to require.resolve
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-react-selector.