This commit is contained in:
Casey Lee 2020-04-24 16:02:34 -07:00
parent 49f565d8e3
commit f749625d6d
No known key found for this signature in database
GPG Key ID: 1899120ECD0A1784
8 changed files with 1592 additions and 47 deletions

15
.eslintrc.yml Normal file
View File

@ -0,0 +1,15 @@
plugins:
- jasmine
env:
commonjs: true
es6: true
node: true
jasmine: true
extends:
- airbnb-base
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018
rules: {}

View File

@ -1,3 +0,0 @@
FROM node:11.6.0
RUN npm install -g jshint@2.9.7
ENTRYPOINT ["jshint"]

View File

@ -1,4 +0,0 @@
name: 'jshint'
runs:
using: 'docker'
image: 'Dockerfile'

View File

@ -1,19 +1,12 @@
name: test-and-deploy name: CI
on: push on: push
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:11.6.0
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm install - run: npm install
- run: npm test - run: npm run lint
- uses: ./.github/workflows/jshint - run: npm run test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- run: env

View File

@ -1,12 +1,11 @@
var express = require('express') const express = require('express');
var app = express()
app.get('/', function (req, res) { const app = express();
app.get('/', (req, res) => {
res.set('Content-Type', 'text/plain'); res.set('Content-Type', 'text/plain');
res.send('Hello World') res.send('Hello World');
}) });
module.exports = app.listen(8080, function () {
console.log('Listening on port 8080')
})
module.exports = app.listen(8080, () => {
});

1554
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,19 @@
"devDependencies": { "devDependencies": {
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-http": "^4.2.1", "chai-http": "^4.2.1",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jasmine": "^4.1.1",
"mocha": "^5.2.0" "mocha": "^5.2.0"
}, },
"resolutions": {
"minimist": "^1.2.3"
},
"scripts": { "scripts": {
"start": "node index.js", "start": "node index.js",
"test": "mocha ./tests --recursive" "test": "mocha ./tests --recursive",
"lint": "eslint ."
} }
} }

View File

@ -1,6 +1,8 @@
const chai = require('chai'); const chai = require('chai');
const should = chai.should(); const should = chai.should();
const chaiHttp = require('chai-http'); const chaiHttp = require('chai-http');
chai.use(chaiHttp); chai.use(chaiHttp);
const app = require('../index.js'); const app = require('../index.js');
@ -8,15 +10,15 @@ const app = require('../index.js');
describe('GET /', () => { describe('GET /', () => {
it('should respond with hello world', (done) => { it('should respond with hello world', (done) => {
chai.request(app) chai.request(app)
.get('/') .get('/')
.end((err, res) => { .end((err, res) => {
// there should be no errors // there should be no errors
should.not.exist(err); should.not.exist(err);
// there should be a 200 status code // there should be a 200 status code
res.status.should.equal(200); res.status.should.equal(200);
// the response should be JSON // the response should be JSON
res.type.should.equal('text/plain'); res.type.should.equal('text/plain');
done(); done();
}); });
}); });
}); });