Open Shady1997 opened 5 days ago
@Shady1997 Is your config file invalid? You didn't share the contents of that file, so I can't be sure.
@Shady1997 Is your config file invalid? You didn't share the contents of that file, so I can't be sure. this the config file:
// cypress.config.js const { defineConfig } = require('cypress');
module.exports = defineConfig({ reporter: 'cypress-mochawesome-reporter', reporterOptions: { reportDir: 'cypress/reports', // Directory where the report will be saved charts: true, reportPageTitle: 'SwagLabs', videoOnFailOnly: true, saveAllAttempts: false, embeddedScreenshots: true, inlineAssets: true, overwrite: true, // Do not overwrite previous reports html: true, // Generate an HTML report json: false, // Optionally, also generate a JSON report timestamp: 'short', // Adds a timestamp to the report file name }, e2e: { baseUrl: 'https://www.saucedemo.com/v1/index.html', // Set your base URL video: true, // Enable video recording supportFile: false, // Disable support file if not needed specPattern: 'cypress/e2e/*/.js', // Adjust this to match your test files screenshotOnRunFailure: true, // Take screenshot on failure defaultCommandTimeout: 10000, // Increase timeout as needed setupNodeEvents(on, config) { // implement node event listeners here require('cypress-mochawesome-reporter/plugin')(on); }, }, });
and this the screenshot after list files to confirm config file included properly
![image](https://github.com/user-attachments/assets/77322b8a-d419-4a8f-b0ed-7a4998146838)
@Shady1997 I think the problem here may be that cypress
is not included in your package.json file. You cannot npx cypress run
. You'll need to install cypress
and run cypress run
- this is why the cypress
module isn't found.
@Shady1997 I think the problem here may be that
cypress
is not included in your package.json file. You cannotnpx cypress run
. You'll need to installcypress
and runcypress run
- this is why thecypress
module isn't found.
Please check this server error log:
@Shady1997
Your configFile is invalid:
It threw an error when required, check the stack trace below:
Error: Cannot find module 'cypress'
This is the error that you will get if cypress
is missing from node_modules
. Normally you would install Cypress locally with
npm install cypress --save-dev
and in .gitignore
you would add
node_modules
Then you include the following files in your commit to the GitLab repo:
package.json
package-lock.json
Your workflow should include
npm ci
to install Cypress into your node_modules
directory on GitLab temporarily.
See https://docs.cypress.io/guides/continuous-integration/gitlab-ci for GitLab examples.
For "how-to" type support you can connect to the Cypress technical community on Discord
Your problem does not seem to be a bug in Cypress. It looks like a configuration error.
Current behavior
Running cypress on gitlab pipeline show the following error:
It threw an error when required, check the stack trace below:
Desired behavior
No response
Test code to reproduce
Require stack:
Cypress Version
cypress@13.14.2
Node version
20.17.0-1nodesource1
Operating System
ubuntu:latest
Debug Logs
No response
Other
No response