mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge pull request #59 from Human-Connection/ci-improvements
CI Improvements
This commit is contained in:
commit
75bb73a5f8
2
.codecov.yml
Normal file
2
.codecov.yml
Normal file
@ -0,0 +1,2 @@
|
||||
coverage:
|
||||
range: "60...100"
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ node_modules/
|
||||
.env
|
||||
.vscode
|
||||
yarn-error.log
|
||||
coverage.lcov
|
||||
.nyc_output/
|
||||
|
||||
@ -22,8 +22,7 @@ install:
|
||||
- docker-compose up -d
|
||||
|
||||
script:
|
||||
- docker-compose exec backend yarn run eslint
|
||||
- docker-compose exec backend yarn run mocha
|
||||
- docker-compose exec backend yarn run ci
|
||||
- docker-compose exec backend yarn run db:reset
|
||||
- docker-compose exec backend yarn run db:seed
|
||||
|
||||
|
||||
11
package.json
11
package.json
@ -7,8 +7,10 @@
|
||||
"no_auth": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 PERMISSIONS=disabled"
|
||||
},
|
||||
"scripts": {
|
||||
"mocha": "./node_modules/.bin/mocha --require @babel/register src/**/*.test.js",
|
||||
"eslint": "eslint src --config .eslintrc.js",
|
||||
"ci": "yarn run lint && yarn run test && yarn run test:coverage",
|
||||
"lint": "eslint src --config .eslintrc.js",
|
||||
"test": "./node_modules/.bin/nyc --reporter=text-lcov ./node_modules/.bin/mocha --require @babel/register src/**/*.test.js",
|
||||
"test:coverage": "./node_modules/.bin/nyc report --reporter=text-lcov > coverage.lcov",
|
||||
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
|
||||
"start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js",
|
||||
"db:script:seed": "wait-on tcp:4001 && ./node_modules/.bin/babel-node src/seed/seed-db.js",
|
||||
@ -36,7 +38,7 @@
|
||||
"graphql": "~0.13.0",
|
||||
"graphql-custom-directives": "~0.2.14",
|
||||
"graphql-iso-date": "~3.6.1",
|
||||
"graphql-middleware": "2.0.2",
|
||||
"graphql-middleware": "~1.7.8",
|
||||
"graphql-shield": "~4.1.2",
|
||||
"graphql-tag": "~2.10.0",
|
||||
"graphql-yoga": "~1.16.7",
|
||||
@ -45,7 +47,7 @@
|
||||
"lodash": "~4.17.11",
|
||||
"ms": "~2.1.1",
|
||||
"neo4j-driver": "~1.7.2",
|
||||
"neo4j-graphql-js": "2.0.1",
|
||||
"neo4j-graphql-js": "~2.0.1",
|
||||
"node-fetch": "~2.3.0",
|
||||
"passport": "~0.4.0",
|
||||
"passport-jwt": "~4.0.0",
|
||||
@ -67,6 +69,7 @@
|
||||
"mocha": "^5.2.0",
|
||||
"nodemon": "~1.18.8",
|
||||
"npm-run-all": "~4.1.5",
|
||||
"nyc": "^13.1.0",
|
||||
"wait-on": "~3.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,5 +9,6 @@ const serverConfig = {
|
||||
}
|
||||
|
||||
server.start(serverConfig, options => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log(`Server ready at ${process.env.GRAPHQL_URI} 🚀`)
|
||||
})
|
||||
|
||||
@ -31,8 +31,10 @@ export default async function (client) {
|
||||
})
|
||||
data[key] = Object.assign(data[key] || {}, res.data)
|
||||
} catch (err) {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(err)
|
||||
}
|
||||
})
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log('Seeded Data', data)
|
||||
}
|
||||
|
||||
@ -12,8 +12,10 @@ const driver = neo4j().getDriver()
|
||||
const session = driver.session()
|
||||
|
||||
query('MATCH (n) DETACH DELETE n', session).then(() => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log('Successfully deleted all nodes and relations!')
|
||||
}).catch((err) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log(`Error occurred deleting the nodes and relations (reset the db)\n\n${err}`)
|
||||
}).finally(() => {
|
||||
if (session) {
|
||||
|
||||
@ -23,6 +23,7 @@ let schema = makeExecutableSchema({
|
||||
const driver = neo4j().getDriver()
|
||||
|
||||
const MOCK = (process.env.MOCK === 'true')
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log('MOCK:', MOCK)
|
||||
|
||||
schema = augmentSchema(schema, {
|
||||
@ -45,7 +46,9 @@ const server = new GraphQLServer({
|
||||
try {
|
||||
const token = payload.req.headers.authorization.replace('Bearer ', '')
|
||||
payload.user = await jwt.verify(token, process.env.JWT_SECRET)
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
return payload
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user