Skip to content

Commit c7b246e

Browse files
authored
Merge pull request #77 from Lemoncode/#76--back-config-specs
config ready
2 parents 1eebdd9 + eaf34e5 commit c7b246e

5 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@ jobs:
88
steps:
99
- name: Checkout repository
1010
uses: actions/checkout@v2
11-
- name: Install
11+
- name: Install front
1212
run: |
1313
cd front
1414
npm install
15+
- name: Install back
16+
run: |
17+
cd back
18+
npm install
1519
- name: Build
1620
run: |
1721
cd front
1822
npm run build
19-
- name: Tests
23+
- name: Tests front
2024
run: |
2125
cd front
2226
npm test
27+
- name: Tests back
28+
run: |
29+
cd back
30+
npm test

‎back/config/test/jest.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
rootDir: '../../',
3+
preset: 'ts-jest',
4+
restoreMocks: true,
5+
setupFiles: ['<rootDir>/config/test/setup.js'],
6+
modulePathIgnorePatterns: ['node_modules', '<rootDir>/dist/'],
7+
testEnvironment: 'node',
8+
moduleDirectories: ['<rootDir>/src', 'node_modules'],
9+
};

‎back/config/test/setup.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { config } = require('dotenv');
2+
config({
3+
path: './.env',
4+
});

‎back/package.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"build:dev": "npm run clean && babel src -d dist --ignore=\"./src/test-runners\" --extensions \".ts\" --source-maps",
1414
"type-check": "tsc --noEmit",
1515
"type-check:watch": "npm run type-check -- --watch",
16+
"test": "cross-env NODE_ENV=test jest -c ./config/test/jest.js --verbose",
17+
"test:watch": "npm run test -- --watchAll -i --no-cache",
1618
"clean": "rimraf dist"
1719
},
1820
"repository": {
@@ -35,11 +37,14 @@
3537
"@babel/preset-typescript": "^7.10.4",
3638
"@types/cors": "^2.8.7",
3739
"@types/express": "^4.17.7",
40+
"@types/jest": "^26.0.15",
3841
"@types/socket.io": "^2.1.10",
3942
"cross-env": "^7.0.2",
43+
"jest": "^26.6.1",
4044
"nodemon": "^2.0.4",
4145
"npm-run-all": "^4.1.5",
4246
"rimraf": "^3.0.2",
47+
"ts-jest": "^26.4.2",
4348
"typescript": "^3.9.7"
4449
},
4550
"dependencies": {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('Room name generator business spec', () => {
2+
it('', () => {
3+
const dummy = true;
4+
expect(dummy).toEqual(true);
5+
});
6+
});

0 commit comments

Comments
 (0)