title: Proper method to implement Jest tests in Jenkins build
body: <p>We're using <strong>Jest</strong> to perform our React.js unit tests (on the frontend) of our Node.js app which runs in a docker container. </p>
  
  <p>We have set up a Pipeline in Jenkins but I'm unsure of the best way (or <em>best practice</em>) to include the tests as part of the pipeline. </p>
  
  <p>The steps we have are the following:</p>
  
  <ol>
  <li>Check out the code from source control</li>
  <li>NPM install and npm run build (front-end)</li>
  <li>Docker build + publish</li>
  <li>Deploy app</li>
  <li>Bump version</li>
  <li>Git push</li>
  <li>Docker cleanup</li>
  </ol>
  
  <p>I have 3 main queries:</p>
  
  <p>A. I'm assuming it's best to include <code>npm run test</code> between <strong>Step 1</strong> and  <strong>Step 2</strong> and if all tests pass successfully to move further? </p>
  
  <p>B. But how are the snapshots handled? For example, if there's some change which occurred that generates a difference in a snapshot this will not be "checked" back into the source control.</p>
  
  <p>C. I read that people use Cobertura, jest-junit, etc to have unit tests and coverage within Jenkins - what is the best?</p>
  
  <p>Thanks in advance.</p>