for test purpose, I want to have a mochawesome report generated with a jenkins job :
I have a jenkins in local with Dockerfile.jenkins:
FROM jenkins/jenkins:lts
USER root
RUN apt-get update && apt-get install -y \
sudo \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb \
&& rm -rf /var/lib/apt/lists/*
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER jenkins
then I added in my docker-compose.yml :
jenkins:
build:
context: .
dockerfile: Dockerfile.jenkins
ports:
- "8080:8080"
- "50000:50000"
volumes:
- jenkins_data:/var/jenkins_home
environment:
- JAVA_OPTS=-Djenkins.install.runSetupWizard=false
In jenkins, I configured the job as :
notes : the job is ok if I don't add the mochawesome report
But I get this error :
+ npx cypress run --reporter mochawesome
[281:0311/120434.279278:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type:
DevTools listening on ws://127.0.0.1:45311/devtools/browser/*******************
Error loading the reporter: mochawesome
We searched for the reporter in these paths:
- /var/jenkins_home/workspace/Cypress Test/mochawesome
- /var/jenkins_home/workspace/Cypress Test/node_modules/mochawesome
Learn more at https://on.cypress.io/reporters
Error: Cannot find module '/var/jenkins_home/workspace/Cypress Test/node_modules/mochawesome'
Require stack:
- /var/jenkins_home/.cache/Cypress/13.3.2/Cypress/resources/app/packages/server/lib/reporter.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at n._resolveFilename (node:electron/js2c/browser_init:2:117603)
at PackherdModuleLoader._tryResolveFilename (evalmachine.<anonymous>:1:745720)
at PackherdModuleLoader._resolvePaths (evalmachine.<anonymous>:1:742510)
at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:740553)
at Function.<anonymous> (evalmachine.<anonymous>:1:751373)
at d._load (<embedded>:4474:29351)
at Module.require (node:internal/modules/cjs/loader:1148:19)
at require (node:internal/modules/cjs/helpers:110:18)
at S.loadReporter (<embedded>:4479:19555)
at S.initializeReporter (<embedded>:4526:26644)
at S.startWebsockets (<embedded>:4526:26948)
at S.open (<embedded>:4526:25245)
at async v.create (<embedded>:4526:38921)
at async O (<embedded>:4526:125935)
at async W (<embedded>:4526:138758)
Build step 'Execute shell' marked build as failure
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /var/jenkins_home/workspace/Cypress Test/cypress/report/mochawesome-report to /var/jenkins_home/jobs/Cypress Test/htmlreports/HTML_20Report
ERROR: Specified HTML directory '/var/jenkins_home/workspace/Cypress Test/cypress/report/mochawesome-report' does not exist.
Finished: FAILURE

