Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .circleci/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2.1

jobs:
Unit:
working_directory: ~/workspace
docker:
- image: circleci/node:12.14
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: yarn install
no_output_timeout: 30m
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Unit tests
command: yarn test
no_output_timeout: 30m
- run:
name: Syntax and code tests
command: yarn lint --fix
no_output_timeout: 30m

workflows:
version: 2
build-and-test:
jobs:
- Unit
59 changes: 38 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
version: 2.1

version: 2
jobs:
Unit:
build:
working_directory: ~/workspace
docker:
- image: circleci/node:12.14
# The below environemnt is where you set the .env variables used throughout node
environment:
NODE_ENV: test
PG_USER: root
PG_DATABASE: cestos
PG_PORT: 5432

- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: root
POSTGRES_DB: cestos

steps:
- checkout

- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-

- run:
name: Install dependencies
name: Install local dependencies
command: yarn install
no_output_timeout: 30m
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Unit tests
command: yarn test
no_output_timeout: 30m

- run:
name: Syntax and code tests
name: Analyze and fix code
command: yarn lint --fix
no_output_timeout: 30m

workflows:
version: 2
build-and-test:
jobs:
- Unit
- run:
name: Wait for Postgres to start
command: dockerize -wait tcp://localhost:5432 -timeout 1m

- run:
name: Migrate the tables
command: yarn db:all

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run:
name: Running Tests
command: yarn test
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DB_DATABASE=cestos
DB_USERNAME=root
DB_PASSWORD=root
DB_PORT=3306
7 changes: 7 additions & 0 deletions .prettiercc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 90
}
8 changes: 8 additions & 0 deletions .sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require('path');

module.exports = {
'config': path.resolve('./database/config.js'),
'migrations-path': path.resolve('./database/migrations'),
'seeders-path': path.resolve('./database/seeders'),
'models-path': path.resolve('./database/models/')
};
24 changes: 24 additions & 0 deletions config/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const debug = process.env.DEBUG || false;
const env = 'development';
const app = {
close: { timeout: 1000 },
listen: {
host: '0.0.0.0',
port: 9000,
},
};
const database = {
cstring: 'postgres://root:root@localhost:5432/cestos',
database: 'cestos',
define: {
createdAt: 'created_at',
updatedAt: 'updated_at'
},
dialect: 'postgres',
host: 'localhost',
password: 'root',
port: 5432,
user: 'root'
};

module.exports = { app, database, debug, env };
18 changes: 18 additions & 0 deletions config/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const debug = process.env.DEBUG || false;
const env = 'test';
const database = {
cstring: 'postgres://root:root@localhost:5432/cestos',
database: 'cestos',
define: {
createdAt: 'created_at',
updatedAt: 'updated_at'
},
dialect: 'postgres',
host: 'localhost',
logging: false,
password: 'root',
port: 5432,
user: 'root'
};

module.exports = { database, debug, env };
54 changes: 51 additions & 3 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1595255803613" clover="3.2.0">
<project timestamp="1595255803613" name="All files">
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
<coverage generated="1595327841024" clover="3.2.0">
<project timestamp="1595327841025" name="All files">
<metrics statements="33" coveredstatements="19" conditionals="9" coveredconditionals="4" methods="3" coveredmethods="2" elements="45" coveredelements="25" complexity="0" loc="33" ncloc="33" packages="2" files="3" classes="3"/>
<package name="config">
<metrics statements="9" coveredstatements="4" conditionals="4" coveredconditionals="2" methods="0" coveredmethods="0"/>
<file name="development.js" path="/home/duarte/Desktop/dev/circleci/config/development.js">
<metrics statements="5" coveredstatements="0" conditionals="2" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="1" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="2" count="0" type="stmt"/>
<line num="3" count="0" type="stmt"/>
<line num="10" count="0" type="stmt"/>
<line num="24" count="0" type="stmt"/>
</file>
<file name="test.js" path="/home/duarte/Desktop/dev/circleci/config/test.js">
<metrics statements="4" coveredstatements="4" conditionals="2" coveredconditionals="2" methods="0" coveredmethods="0"/>
<line num="1" count="1" type="cond" truecount="2" falsecount="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="18" count="1" type="stmt"/>
</file>
</package>
<package name="src.clients">
<metrics statements="24" coveredstatements="15" conditionals="5" coveredconditionals="2" methods="3" coveredmethods="2"/>
<file name="sequelize-client.js" path="/home/duarte/Desktop/dev/circleci/src/clients/sequelize-client.js">
<metrics statements="24" coveredstatements="15" conditionals="5" coveredconditionals="2" methods="3" coveredmethods="2"/>
<line num="1" count="1" type="stmt"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="4" count="1" type="stmt"/>
<line num="5" count="1" type="cond" truecount="0" falsecount="1"/>
<line num="9" count="1" type="stmt"/>
<line num="30" count="1" type="stmt"/>
<line num="32" count="1" type="stmt"/>
<line num="33" count="0" type="stmt"/>
<line num="39" count="0" type="stmt"/>
<line num="43" count="0" type="stmt"/>
<line num="44" count="0" type="stmt"/>
<line num="45" count="0" type="stmt"/>
<line num="47" count="0" type="stmt"/>
<line num="48" count="0" type="stmt"/>
<line num="51" count="0" type="stmt"/>
<line num="54" count="1" type="stmt"/>
<line num="56" count="1" type="stmt"/>
<line num="57" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="58" count="1" type="stmt"/>
<line num="59" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="60" count="0" type="stmt"/>
<line num="64" count="1" type="stmt"/>
<line num="66" count="1" type="stmt"/>
</file>
</package>
</project>
</coverage>
5 changes: 4 additions & 1 deletion coverage/coverage-final.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{"/home/duarte/Desktop/dev/circleci/config/development.js": {"path":"/home/duarte/Desktop/dev/circleci/config/development.js","statementMap":{"0":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}},"1":{"start":{"line":2,"column":12},"end":{"line":2,"column":25}},"2":{"start":{"line":3,"column":12},"end":{"line":9,"column":1}},"3":{"start":{"line":10,"column":17},"end":{"line":22,"column":1}},"4":{"start":{"line":24,"column":0},"end":{"line":24,"column":47}}},"fnMap":{},"branchMap":{"0":{"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}},"type":"binary-expr","locations":[{"start":{"line":1,"column":14},"end":{"line":1,"column":31}},{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}],"line":1}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0},"f":{},"b":{"0":[0,0]}}
,"/home/duarte/Desktop/dev/circleci/config/test.js": {"path":"/home/duarte/Desktop/dev/circleci/config/test.js","statementMap":{"0":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}},"1":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}},"2":{"start":{"line":3,"column":17},"end":{"line":16,"column":1}},"3":{"start":{"line":18,"column":0},"end":{"line":18,"column":42}}},"fnMap":{},"branchMap":{"0":{"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}},"type":"binary-expr","locations":[{"start":{"line":1,"column":14},"end":{"line":1,"column":31}},{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}],"line":1}},"s":{"0":1,"1":1,"2":1,"3":1},"f":{},"b":{"0":[1,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"fa397d08f6c27caac67313cb08c5c0c778ea5ca3"}
,"/home/duarte/Desktop/dev/circleci/src/clients/sequelize-client.js": {"path":"/home/duarte/Desktop/dev/circleci/src/clients/sequelize-client.js","statementMap":{"0":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}},"1":{"start":{"line":2,"column":10},"end":{"line":2,"column":27}},"2":{"start":{"line":3,"column":15},"end":{"line":3,"column":32}},"3":{"start":{"line":4,"column":15},"end":{"line":4,"column":32}},"4":{"start":{"line":5,"column":68},"end":{"line":7,"column":1}},"5":{"start":{"line":9,"column":18},"end":{"line":28,"column":2}},"6":{"start":{"line":30,"column":11},"end":{"line":30,"column":24}},"7":{"start":{"line":32,"column":0},"end":{"line":52,"column":2}},"8":{"start":{"line":33,"column":2},"end":{"line":38,"column":4}},"9":{"start":{"line":39,"column":22},"end":{"line":39,"column":61}},"10":{"start":{"line":43,"column":2},"end":{"line":49,"column":3}},"11":{"start":{"line":44,"column":4},"end":{"line":44,"column":35}},"12":{"start":{"line":45,"column":4},"end":{"line":45,"column":31}},"13":{"start":{"line":47,"column":4},"end":{"line":47,"column":33}},"14":{"start":{"line":48,"column":4},"end":{"line":48,"column":12}},"15":{"start":{"line":51,"column":2},"end":{"line":51,"column":16}},"16":{"start":{"line":54,"column":0},"end":{"line":68,"column":2}},"17":{"start":{"line":56,"column":4},"end":{"line":63,"column":7}},"18":{"start":{"line":57,"column":6},"end":{"line":62,"column":7}},"19":{"start":{"line":58,"column":8},"end":{"line":58,"column":30}},"20":{"start":{"line":59,"column":8},"end":{"line":61,"column":9}},"21":{"start":{"line":60,"column":10},"end":{"line":60,"column":34}},"22":{"start":{"line":64,"column":4},"end":{"line":64,"column":25}},"23":{"start":{"line":66,"column":4},"end":{"line":66,"column":14}}},"fnMap":{"0":{"name":"transaction","decl":{"start":{"line":32,"column":32},"end":{"line":32,"column":43}},"loc":{"start":{"line":32,"column":57},"end":{"line":52,"column":1}},"line":32},"1":{"name":"(anonymous_1)","decl":{"start":{"line":55,"column":8},"end":{"line":55,"column":9}},"loc":{"start":{"line":55,"column":14},"end":{"line":67,"column":3}},"line":55},"2":{"name":"(anonymous_2)","decl":{"start":{"line":56,"column":32},"end":{"line":56,"column":33}},"loc":{"start":{"line":56,"column":41},"end":{"line":63,"column":5}},"line":56}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":35}},"type":"default-arg","locations":[{"start":{"line":5,"column":28},"end":{"line":5,"column":35}}],"line":5},"1":{"loc":{"start":{"line":57,"column":6},"end":{"line":62,"column":7}},"type":"if","locations":[{"start":{"line":57,"column":6},"end":{"line":62,"column":7}},{"start":{"line":57,"column":6},"end":{"line":62,"column":7}}],"line":57},"2":{"loc":{"start":{"line":59,"column":8},"end":{"line":61,"column":9}},"type":"if","locations":[{"start":{"line":59,"column":8},"end":{"line":61,"column":9}},{"start":{"line":59,"column":8},"end":{"line":61,"column":9}}],"line":59}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":1,"17":1,"18":1,"19":1,"20":1,"21":0,"22":1,"23":1},"f":{"0":0,"1":1,"2":1},"b":{"0":[0],"1":[1,0],"2":[0,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"4700e017590a0f6627dd051b82fea45c1be5108c"}
}
152 changes: 152 additions & 0 deletions coverage/lcov-report/config/development.js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@

<!doctype html>
<html lang="en">

<head>
<title>Code coverage report for config/development.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>

<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">config</a> development.js</h1>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/5</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/2</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/5</span>
</div>


</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const debug = <span class="cstat-no" title="statement not covered" >process.env.DEBUG || false;</span>
const env = <span class="cstat-no" title="statement not covered" >'development';</span>
const app = <span class="cstat-no" title="statement not covered" >{</span>
close: { timeout: 1000 },
listen: {
host: '0.0.0.0',
port: 9000,
},
};
const database = <span class="cstat-no" title="statement not covered" >{</span>
cstring: 'postgres://root:root@localhost:5432/cestos',
database: 'cestos',
define: {
createdAt: 'created_at',
updatedAt: 'updated_at'
},
dialect: 'postgres',
host: 'localhost',
password: 'root',
port: 5432,
user: 'root'
};
&nbsp;
<span class="cstat-no" title="statement not covered" >module.exports = { app, database, debug, env };</span>
&nbsp;</pre></td></tr></table></pre>

<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Tue Jul 21 2020 11:37:21 GMT+0100 (Western European Summer Time)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.