cleanup
This commit is contained in:
parent
49f565d8e3
commit
f749625d6d
|
@ -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: {}
|
|
@ -1,3 +0,0 @@
|
|||
FROM node:11.6.0
|
||||
RUN npm install -g jshint@2.9.7
|
||||
ENTRYPOINT ["jshint"]
|
|
@ -1,4 +0,0 @@
|
|||
name: 'jshint'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
|
@ -1,19 +1,12 @@
|
|||
name: test-and-deploy
|
||||
name: CI
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:11.6.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
- uses: ./.github/workflows/jshint
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- run: env
|
||||
- run: npm run lint
|
||||
- run: npm run test
|
||||
|
|
17
index.js
17
index.js
|
@ -1,12 +1,11 @@
|
|||
var express = require('express')
|
||||
var app = express()
|
||||
const express = require('express');
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
const app = express();
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.set('Content-Type', 'text/plain');
|
||||
res.send('Hello World')
|
||||
})
|
||||
|
||||
module.exports = app.listen(8080, function () {
|
||||
console.log('Listening on port 8080')
|
||||
})
|
||||
res.send('Hello World');
|
||||
});
|
||||
|
||||
module.exports = app.listen(8080, () => {
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -11,10 +11,19 @@
|
|||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"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"
|
||||
},
|
||||
"resolutions": {
|
||||
"minimist": "^1.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"test": "mocha ./tests --recursive"
|
||||
"test": "mocha ./tests --recursive",
|
||||
"lint": "eslint ."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const chai = require('chai');
|
||||
|
||||
const should = chai.should();
|
||||
const chaiHttp = require('chai-http');
|
||||
|
||||
chai.use(chaiHttp);
|
||||
|
||||
const app = require('../index.js');
|
||||
|
@ -8,15 +10,15 @@ const app = require('../index.js');
|
|||
describe('GET /', () => {
|
||||
it('should respond with hello world', (done) => {
|
||||
chai.request(app)
|
||||
.get('/')
|
||||
.end((err, res) => {
|
||||
.get('/')
|
||||
.end((err, res) => {
|
||||
// there should be no errors
|
||||
should.not.exist(err);
|
||||
// there should be a 200 status code
|
||||
res.status.should.equal(200);
|
||||
// the response should be JSON
|
||||
res.type.should.equal('text/plain');
|
||||
done();
|
||||
});
|
||||
should.not.exist(err);
|
||||
// there should be a 200 status code
|
||||
res.status.should.equal(200);
|
||||
// the response should be JSON
|
||||
res.type.should.equal('text/plain');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue