Skip to content
The files for my tutorial on continuous intregration with Jest, Express, and Travis CI
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
.gitignore
.travis.yml
LICENSE
README.md
app.js
package-lock.json
package.json
server.js

README.md

Build Status

Earn a Build Passing Badge on GitHub ! Testing Your Express App with Travis CI


This repo contains the are the files for my tutorial on continuous intregration with Jest, Express, and Travis CI.

It also serves as a live example! Whenever there is a commit to master, Travis CI will queue up a new test build.

The result of that build will affect the Build Status badge you see at the top there. If the build fails, I will get an email too.


npm i will install all of the dependencies. The rest of the application — how to run and test it — is explained below.


app.js

This contains our application routes and logic.

const express = require('express');
const app = express();

app.get('/', async (req, res) => res.status(200).send('Hello World!'));

module.exports = app;

server.js

npm start will run this file, running the application.

const app = require('./app');
const port = 3000;

app.listen(port, () => console.log(`Example app listening on port ${port}!`))

app.test.js

Here are our tests for Jest to run when npm test is called.

const app = require('../app');
const request = require('supertest');

describe('GET /', () => {
    it('responds with 200', async () => {
        await request(app)
            .get('/')
            .expect(200);
    });
})

.travis.yml

This file tells Travis CI how to setup testing for the repository. Make sure you've installed Travis CI as a GitHub App and toggled on repository permissions.

language: node_js
node_js:
- lts/*
You can’t perform that action at this time.