Skip to content

Commit a3979dc

Browse files
authored
Separate tests (#16)
* Separate tests between features and unit tests * Update cleanup script
1 parent fa16caf commit a3979dc

22 files changed

+13
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
config/database.js
44
coverage/
55
.nyc_output
6+
.DS_STORE

.nycrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"exclude": [
44
"container.js",
55
"app/Application.js",
6-
"interfaces/http/Server.js"
6+
"interfaces/http"
77
],
88
"reporter": [
99
"html",

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"scripts": {
1111
"start": "node cluster.js",
1212
"dev": "cross-env NODE_PATH=. NODE_ENV=development nodemon",
13-
"test": "cross-env NODE_PATH=. NODE_ENV=test mocha",
14-
"coverage": "cross-env NODE_PATH=. NODE_ENV=test nyc mocha",
13+
"test": "npm run test:all",
14+
"test:all": "npm run test:unit && npm run test:features",
15+
"test:unit": "cross-env NODE_PATH=. NODE_ENV=test mocha --opts test/mocha.opts.unit",
16+
"test:features": "cross-env NODE_PATH=. NODE_ENV=test mocha --opts test/mocha.opts.features",
17+
"coverage": "cross-env NODE_PATH=. NODE_ENV=test nyc mocha --opts test/mocha.opts.unit",
1518
"lint": "eslint {src,test,config}/**/*.js",
1619
"sequelize": "cross-env NODE_PATH=. sequelize",
1720
"console": "cross-env NODE_PATH=. node src/interfaces/console/index.js",

scripts/cleanup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Listr = require('listr');
55

66
const srcPath = path.join(__dirname, '..', 'src');
77
const testPath = path.join(__dirname, '..', 'test');
8-
const srcAndTestPath = `{${testPath},${srcPath}}`;
8+
const srcAndTestPath = `{${testPath}/unit,${srcPath}}`;
99
const routerPath = path.join(srcPath, 'interfaces', 'http', 'router.js');
1010
const containerPath = path.join(srcPath, 'container.js');
1111

@@ -48,7 +48,7 @@ const tasks = new Listr([
4848
path.join(srcPath, 'infra', 'database', 'seeds', '*.js'),
4949
path.join(srcPath, 'infra', 'database', 'models', 'User.js'),
5050
path.join(srcPath, 'interfaces', 'http', 'user', '**'),
51-
path.join(testPath, 'api', 'users', '**'),
51+
path.join(testPath, 'features', 'api', 'users', '**'),
5252
path.join(testPath, 'support', 'factories', '*.js')
5353
]);
5454
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)