Skip to content

Commit 6a28bc5

Browse files
[-] Technical - Use Jest instead of Mocha for the test base (#260)
1 parent d2c9251 commit 6a28bc5

File tree

15 files changed

+2740
-1269
lines changed

15 files changed

+2740
-1269
lines changed

.eslint-bin/js-list.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"src/services/pie-stat-getter.js",
88
"src/services/resources-getter.js",
99
"src/services/value-stat-getter.js",
10-
"test/.eslintrc.js"
10+
"test/tests/adapters/mongoose.test.js",
11+
"test/tests/services/filters-parser.test.js",
12+
"test/tests/services/query-builder.test.js",
13+
"test/tests/services/resources-getter.test.js"
1114
]

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ module.exports = {
22
root: true,
33
'extends': [
44
'airbnb-base',
5+
'plugin:jest/all'
56
],
67
plugins: [],
78
env: {
89
node: true,
910
},
1011
rules: {
12+
'jest/no-hooks': 0,
1113
'no-console': 0,
1214
'no-param-reassign': 0,
1315
'no-underscore-dangle': 0,
@@ -31,7 +33,8 @@ module.exports = {
3133
'error',
3234
{
3335
'devDependencies': [
34-
'bin/*.js',
36+
'.eslint-bin/*.js',
37+
'scripts/*.js',
3538
'test/**/*.js'
3639
]
3740
}

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ before_install:
1414
- docker ps
1515

1616
script:
17-
- npm run lint:ci
18-
- npm run test
17+
- yarn lint:ci
18+
- yarn test

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22

33
## [Unreleased]
4+
### Added
5+
- Readme - Add the test coverage badge.
6+
7+
### Changed
8+
- Technical - Use Jest instead of Mocha for the test base.
49

510
## RELEASE 5.2.0 - 2019-11-18
611
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Forest Admin in Nodejs (Express.js & Mongoose)
22
[![npm package](https://badge.fury.io/js/forest-express-mongoose.svg)](https://badge.fury.io/js/forest-express-mongoose) [![CI status](https://travis-ci.org/ForestAdmin/forest-express-mongoose.svg?branch=devel)](https://travis-ci.org/ForestAdmin/forest-express-mongoose)
3-
3+
![Coverage](https://img.shields.io/badge/coverage-80%25%0A-critical)
44

55
Forest Admin provides an off-the-shelf administration panel based on a highly-extensible API plugged into your application.
66

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@
3838
"babel-plugin-transform-runtime": "7.0.0-beta.3",
3939
"babel-preset-env": "7.0.0-beta.3",
4040
"babel-register": "7.0.0-beta.3",
41-
"chai": "4.2.0",
42-
"chai-as-promised": "7.1.1",
43-
"chai-subset": "1.6.0",
4441
"dotenv": "6.2.0",
4542
"eslint": "5.16.0",
4643
"eslint-config-airbnb": "16.1.0",
4744
"eslint-plugin-import": "2.17.2",
45+
"eslint-plugin-jest": "23.0.4",
4846
"eslint-plugin-jsx-a11y": "6.0.2",
4947
"eslint-plugin-react": "7.5.1",
50-
"mocha": "6.1.4",
48+
"jest": "24.9.0",
5149
"mongoose": "5.5.9",
5250
"mongoose-fixture-loader": "1.0.2",
5351
"onchange": "6.0.0",
@@ -57,12 +55,13 @@
5755
"scripts": {
5856
"build": "./node_modules/babel-cli/bin/babel.js src --out-dir dist && echo '\n\\033[0;34m[+] \\033[0;32mBuild done\\033[0m'",
5957
"build:watch": "onchange 'src/**/*.js' -i -- yarn build",
60-
"release": "yarn build && node ./scripts/release.js",
61-
"test": "./node_modules/mocha/bin/mocha test/**/* --require babel-register --timeout 15000",
62-
"test:watch": "./node_modules/mocha/bin/mocha test/**/* adapters/** services/** utils/** --timeout 15000 --watch",
6358
"lint": "./node_modules/eslint/bin/eslint.js test src",
6459
"lint:ci": "node ./.eslint-bin/lint-registered-files.js",
65-
"pre-commit": "node ./.eslint-bin/pre-commit-hook.js"
60+
"pre-commit": "node ./.eslint-bin/pre-commit-hook.js",
61+
"readme:update-coverage": "yarn test:coverage && node ./scripts/update-coverage.js",
62+
"release": "yarn build && node ./scripts/release.js",
63+
"test": "jest",
64+
"test:coverage": "jest --coverage"
6665
},
6766
"pre-commit": [
6867
"pre-commit"

scripts/update-coverage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { CoverageManager } = require('@forestadmin/devops');
2+
3+
new CoverageManager().updateBadge();

test/.eslintrc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/tests/adapters/expected-results/real-world-schema.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,20 @@
214214
},
215215
{
216216
"field": "method",
217-
"type": "Enum"
217+
"type": "Enum",
218+
"enums": [
219+
"number",
220+
"percentile",
221+
"list"
222+
]
218223
},
219224
{
220225
"field": "direction",
221-
"type": "Enum"
226+
"type": "Enum",
227+
"enums": [
228+
"gt",
229+
"lt"
230+
]
222231
},
223232
{
224233
"field": "limit",

0 commit comments

Comments
 (0)