Open aman2810khan opened 2 years ago
Hi even I observe the same error when I run my scripts in browserStack. Any alternatives or fix for this please?
Running: movSvc/testCaseCheckTest.spec.js
Oops...we found an error preparing this test file:
cypress\support\index.js
The error was:
Error: Webpack Compilation Error ./cypress/support/commands.js Module not found: Error: Can't resolve '@testing-library/cypress/add-commands' in 'cypress_test_folder\cypress\support' resolve '@testing-library/cypress/add-commands' in 'cypress_test_folder\cypress\support' Parsed request is a module using description file: cypress_test_folder\package.json (relative path: ./cypress/support) Field 'browser' doesn't contain a valid alias configuration Looked for and couldn't find the file at the following paths: [cypress_test_folder\cypress\support\node_modules] [cypress_test_folder\cypress\node_modules] [node_modules]
@aman2810khan did you find a solution? We have the same error on Github actions. Locally it runs fine.
I had an old import in my command.js file removing the import got rid of the error.
@aman2810khan @amruth963 @rmcsharry did you guys figured it out ? I am facing this issue while integrating with lambdatest, locally it is running fine. Using cypress@9.6.0
For me, while running on github actions it is running fine.
I have installed DOM and Cypress testing library modules in my react project :
npm install --save-dev @testing-library/dom npm install --save-dev @testing-library/cypress
As mentioned in testing library docs , I have added the following import statement in cypress/support/commands.js : import '@testing-library/cypress/add-commands';
The problem is node_modules is present in my .gitignore file and when the pipeline runs the cypress tests (files with extension .spec.js) on Gitlab ,it throws the following error : Module not found: Error: Can't resolve '@testing-library/cypress/add-commands'
Is there any alternate way for using the cypress testing library commands?