How to run Jest tests on a Jenkins server

I am trying to run my Jest Test while deploying Jenkins. If I ssh on the server, I can sudo in jenkins user ans to successfully run tests from the workspace. However, I get an error when trying to build a project from the GUI. Here is my project setup:

I installed the nodejs plugin and it installs gulp, jest-cli and babel globally. enter image description here

Then in the assembly steps:

enter image description here

This error failed:

TypeError: Cannot read property 'getResourceByPath' of null at Loader.getDependenciesFromPath (/var/lib/jenkins/workspace/PHPStaging/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:570:39) at /var/lib/jenkins/workspace/PHPStaging/node_modules/jest-cli/src/TestRunner.js:250:22 at process._tickCallback (node.js:368:9) Running 6 test suites... FAIL resources/__tests__/myTest.js` 

Node seems to have difficulty requiring modules to test, but I'm not quite sure. Any help or guidance would be appreciated.

+7
jenkins jestjs
source share

No one has answered this question yet.

See similar questions:

10
How to deploy a host application to a remote host from Jenkins?

or similar:

2237
How to pass command line arguments to Node.js?
2201
How to decide when to use Node.js?
1648
How to quit Node.js
709
How to restart Jenkins manually?
17
Gesture No Tests
2
Module missing when running Jest tests with Arangodb
one
Chromedriver works manually, but does not work when ran from Jenkins Slave
0
Jenkins can't run sonar runner program
0
Error starting jest on node 0.12.0
0
Jenkins and npm / jest in jenkins pipes: enoent events.js

All Articles