Skip to content

Commit 7551607

Browse files
committed
Add vscode configuration; Update coverage configuration
1 parent d9ff0af commit 7551607

File tree

9 files changed

+38
-53
lines changed

9 files changed

+38
-53
lines changed

.github/workflows/build.yaml

+2-5
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ jobs:
3737
- name: Build application
3838
run: npm run build
3939

40-
- name: Run unit tests
41-
run: npm run test:unit:cov
42-
43-
- name: Run e2e tests
40+
- name: Run tests
4441
run: |
4542
docker-compose -f docker-compose.test.yaml up -d
46-
npm run test:e2e
43+
npm run test:cov
4744
4845
- name: SonarCloud Scan
4946
uses: sonarsource/sonarcloud-github-action@master

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.idea/*
2-
.vscode/*
3-
.unit-test/*
2+
.coverage/*
43
node_modules/*
54
dist/*
65
test-report.xml

.vscode/launch.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "RUN",
11+
"program": "${workspaceFolder}/dist/Main.js",
12+
"sourceMaps": true,
13+
"args": ["dotenv_config_path=/${workspaceFolder}/dist/.env"],
14+
"skipFiles": ["<node_internals>/**"],
15+
"runtimeArgs": ["-r", "dotenv/config"],
16+
"preLaunchTask": "npm: copy:local-env",
17+
"outputCapture": "std"
18+
}
19+
]
20+
}

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.lightbulb.enabled": false,
3+
"jestrunner.configPath": "jest.json"
4+
}

README.md

+4-14
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,11 @@ IPoster is a simple fictional application that allows users to publish posts.
8989

9090
* **Testing**
9191

92-
* unit tests:
93-
* Run tests - `npm run test:unit`
94-
* Run tests with coverage - `npm run test:unit:cov`
95-
* Run tests in `watch` mode - `npm run test:unit:watch`
96-
97-
* e2e tests:
98-
* Prepare environment - `docker-compose -f docker-compose.test.yaml up -d`
99-
* Run tests - `npm run test:e2e`
92+
* Prepare environment - `docker-compose -f docker-compose.test.yaml up -d`
93+
* Run tests - `npm run test:unit`
94+
* Run tests with coverage - `npm run test:unit:cov`
10095

101-
10296
* **Libraries checking**
10397

10498
* Show new libraries' versions - `npm run lib:check`
105-
* Upgrade libraries' versions - `npm run lib:upgrade`
106-
107-
* **IDE configuring**
108-
* [Run application in the IntelliJ IDEA](./asset/IdeaApplicationLaunchConfiguration.png)
109-
* [Run unit tests in the IntelliJ IDEA](./asset/IdeaUnitTestConfiguration.png)
99+
* Upgrade libraries' versions - `npm run lib:upgrade`

jest.e2e.json

-22
This file was deleted.

jest.unit.json renamed to jest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"rootDir": ".",
77
"verbose": true,
88
"testEnvironment": "node",
9-
"testRegex": "test/unit/.*.spec.ts",
9+
"testRegex": "./test/.*.spec.ts$",
1010
"coverageReporters": [
1111
"json-summary",
1212
"text",
1313
"lcov"
1414
],
15-
"coverageDirectory": ".unit-test",
15+
"coverageDirectory": ".coverage",
1616
"collectCoverageFrom": [
1717
"src/**/*.ts"
1818
],

package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
"copy:local-env": "cp ./env/local.app.env ./dist/.env",
99
"start": "node ./dist/Main.js",
1010
"start:local": "npm run copy:local-env && cd ./dist && node -r dotenv/config Main.js",
11-
"test:unit": "jest --config jest.unit.json",
12-
"test:unit:watch": "jest --config jest.unit.json --watch",
13-
"test:unit:cov": "jest --config jest.unit.json --coverage",
14-
"test:e2e": "jest --config jest.e2e.json",
11+
"test": "jest --config jest.json",
12+
"test:cov": "jest --config jest.json --coverage",
1513
"lib:check": "ncu",
1614
"lib:upgrade": "ncu -u && npm install",
1715
"lint": "eslint '{src,test}/**/*.ts'",
@@ -89,7 +87,7 @@
8987
"uuid": "8.3.0"
9088
},
9189
"jest-junit": {
92-
"outputDirectory": ".unit-test"
90+
"outputDirectory": ".coverage"
9391
},
9492
"jestSonar": {
9593
"sonar56x": true

sonar-project.properties

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ sonar.projectVersion=1.0.0
55
sonar.sources=src
66
sonar.tests=test
77
sonar.test=test/**/*.spec.ts
8-
sonar.coverage.exclusions=src/application/**,src/infrastructure/**,src/Main.ts
9-
sonar.junit.reportPaths=.unit-test/junit.xml
10-
sonar.typescript.lcov.reportPaths=.unit-test/lcov.info
8+
sonar.junit.reportPaths=.coverage/junit.xml
9+
sonar.typescript.lcov.reportPaths=.coverage/lcov.info

0 commit comments

Comments
 (0)