How it works...

We've configured our Jenkins job, now let's test it. I'm going to modify a simple file to be sure the Jenkins works properly.

At this point (if you followed the first recipe), you must stop the PM2 server with the command "npm run stop" and then remove the production directory that we cloned before, to avoid problems with the Jenkins job.

Let's modify our Home component; I'll add an extra text (Jenkins):

  import React from 'react';  import styles from './Home.scss';  const Home = props => (    <h1 className={styles.Home}>Hello {props.name || 'World'} (Jenkins)</h1>  );  export default Home;
File: src/client/home/index.jsx

After that, you need to commit and push to master. Now go to Jenkins, select your job, and click on Build Now ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.