Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/healeycodes/earn-a-build-passing-badge
The files for my tutorial on continuous intregration with Jest, Express, and Travis CI ✅
https://github.com/healeycodes/earn-a-build-passing-badge
express jest travis-ci
Last synced: about 1 month ago
JSON representation
The files for my tutorial on continuous intregration with Jest, Express, and Travis CI ✅
- Host: GitHub
- URL: https://github.com/healeycodes/earn-a-build-passing-badge
- Owner: healeycodes
- License: mit
- Created: 2019-03-20T21:05:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-22T23:35:01.000Z (almost 6 years ago)
- Last Synced: 2024-10-05T17:42:38.633Z (4 months ago)
- Topics: express, jest, travis-ci
- Language: JavaScript
- Homepage:
- Size: 56.6 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.com/healeycodes/earn-a-build-passing-badge.svg?branch=master)](https://travis-ci.com/healeycodes/earn-a-build-passing-badge)
### Earn a Build Passing Badge on GitHub ✅! Testing Your Express App with Travis CI
This repo contains the are the files for [my tutorial](https://healeycodes.github.io/javascript/webdev/github/beginners/2019/03/15/build-passing-badge.html) 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.
```javascript
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.
```javascript
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.
```javascript
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](https://docs.travis-ci.com/user/customizing-the-build/) for the repository. Make sure you've installed Travis CI as a GitHub App and toggled on repository permissions.
```yml
language: node_js
node_js:
- lts/*
```