Skip to content

Commit 422515e

Browse files
committed
🐛 fix: fixed testing coverage and configuration workflow
aded a test and changed the test workflow
1 parent c959546 commit 422515e

File tree

6 files changed

+52
-41
lines changed

6 files changed

+52
-41
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,20 @@ jobs:
3232
- name: 📦 Install Node.js dependencies
3333
run: npm ci
3434

35-
- name: 📦 Install Node.js dependencies with Bun
36-
run: bun install --frozen-lockfile
37-
3835
# CHANGE/ADD/SETUP YOUR ADDITIONAL TEST COMMANDS AND TEST ACTIONS BELOW HERE:
3936

4037
- name: 🧪 📊 Test and coverage
41-
run: npm run test
42-
43-
- name: 🧪 📊 Test and coverage with Bun
44-
run: bun run test
38+
run: npm test
4539

4640
- name: 📤 📊 Upload coverage reports to Codecov
4741
uses: codecov/codecov-action@v4.0.1
4842
with:
49-
#token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
50-
#fail_ci_if_error: true # optional (default = false)
51-
#file: ./coverage.xml # optional
52-
#files: ./coverage1.xml,./coverage2.xml # optional
53-
#flags: unittests # optional
43+
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
44+
# file: ./coverage.xml # optional
45+
# files: ./coverage1.xml,./coverage2.xml # optional
46+
# directory: ./coverage/reports/ # optional
47+
# flags: unittests # optional
48+
# env_vars: OS,PYTHON # optional
5449
name: ☂️ codecov-umbrella # optional
50+
# fail_ci_if_error: true # optional (default = false)
5551
verbose: true # optional (default = false)

jest.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"clearMocks": true,
33
"collectCoverage": true,
4+
"collectCoverageFrom": ["./src/**"],
45
"coverageDirectory": "coverage",
6+
"coverageThreshold": {
7+
"global": {
8+
"lines": 90
9+
}
10+
},
511
"coverageProvider": "v8",
612
"extensionsToTreatAsEsm": [".ts"],
713
"testTimeout": 20000,

package.json

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"release:ci": "semantic-release",
113113
"security": "bunx snyk code test --all-projects || echo 'Issues were found please run: bunx snyk code test' && bunx snyk test --all-projects || echo 'Issues were found please run: bunx snyk test'",
114114
"security:fix": "snyk fix",
115-
"test": "NODE_OPTIONS=--experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests",
115+
"test": "node_modules/jest/bin/jest.js",
116116
"test:changed": "bun run test -- --onlyChanged",
117117
"test:clear": "bun run test --clearCache",
118118
"test:dev": "bun run test:clear && bun run test:watch",
@@ -134,13 +134,13 @@
134134
".eslintrc.json",
135135
".eslintignore",
136136
".gitignore",
137+
".prettierignore",
137138
".prettierrc.json",
138139
"license",
139-
".prettierignore",
140140
"commit-template.hbs",
141141
"commitlint.config.ts",
142-
"readme.md",
143142
"default-template.hbs",
143+
"readme.md",
144144
"emojitypescommitmessages.txt",
145145
"jest.config.json",
146146
"package-lock.json",
@@ -150,18 +150,25 @@
150150
"tsconfig.json",
151151
"typedoc.json",
152152
".vscode/settings.json",
153-
"public/.gitkeep",
153+
"repo_management_files/cz-emoji-type-extract.js",
154154
"repo_management_files/cz-type-extract.js",
155155
"repo_management_files/directorystructuredocument.md",
156156
"repo_management_files/extractfilescopes.js",
157-
"repo_management_files/cz-emoji-type-extract.js",
158157
"repo_management_files/genericcommitmessages.md",
158+
"repo_management_files/gitmojisemver-extract.js",
159159
"repo_management_files/issues.sh",
160160
"repo_management_files/labels.sh",
161-
"repo_management_files/gitmojisemver-extract.js",
162161
"repo_management_files/packagejsondocument.md",
163-
".husky/prepare-commit-msg",
162+
"public/.gitkeep",
163+
".github/dependabot.yml",
164+
".github/workflows/build.yml",
165+
".github/workflows/docs.yml",
166+
".github/workflows/lint.yml",
167+
".github/workflows/pr.yml",
168+
".github/workflows/release.yml",
169+
".github/workflows/test.yml",
164170
".husky/commit-msg",
171+
".husky/prepare-commit-msg",
165172
".husky/_/.gitignore",
166173
".husky/_/applypatch-msg",
167174
".husky/_/commit-msg",
@@ -171,39 +178,33 @@
171178
".husky/_/post-commit",
172179
".husky/_/post-merge",
173180
".husky/_/post-rewrite",
181+
".husky/_/pre-applypatch",
174182
".husky/_/pre-auto-gc",
175183
".husky/_/pre-commit",
176184
".husky/_/pre-push",
177-
".husky/_/pre-applypatch",
178-
".husky/_/prepare-commit-msg",
179185
".husky/_/pre-rebase",
180-
".github/dependabot.yml",
181-
".github/workflows/build.yml",
182-
".github/workflows/docs.yml",
183-
".github/workflows/lint.yml",
184-
".github/workflows/pr.yml",
185-
".github/workflows/release.yml",
186-
".github/workflows/test.yml",
186+
".husky/_/prepare-commit-msg",
187187
"src/app.ts",
188188
"src/bin/.gitkeep",
189189
"src/controllers/.gitkeep",
190-
"src/middleware/.gitkeep",
191-
"src/plugins/.gitkeep",
192-
"src/models/.gitkeep",
193190
"src/configs/.gitkeep",
191+
"src/models/.gitkeep",
192+
"src/plugins/.gitkeep",
193+
"src/middleware/.gitkeep",
194194
"src/views/.gitkeep",
195-
"src/routes/.gitkeep",
196195
"src/utils/.gitkeep",
196+
"src/routes/.gitkeep",
197197
"test/.gitkeep",
198-
"test/controllers/.gitkeep",
199-
"test/plugins/.gitkeep",
200-
"test/models/.gitkeep",
198+
"test/app.test.ts",
199+
"test/bin/.gitkeep",
201200
"test/configs/.gitkeep",
202201
"test/middleware/.gitkeep",
203-
"test/routes/.gitkeep",
202+
"test/models/.gitkeep",
203+
"test/plugins/.gitkeep",
204+
"test/controllers/.gitkeep",
204205
"test/views/.gitkeep",
205-
"test/bin/.gitkeep",
206-
"test/utils/.gitkeep"
206+
"test/utils/.gitkeep",
207+
"test/routes/.gitkeep"
207208
],
208209
"questions": {
209210
"scope": "Specify a scope: "

src/app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
//Code below
2-
console.log("hello world!")
1+
export default function sum(a: any, b: any) {
2+
return a + b;
3+
}

test/app.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sum from '../src/app';
2+
3+
describe('Sum', () => {
4+
test('sum two numbers', () => {
5+
expect(sum(1, 1)).toEqual(2);
6+
});
7+
});

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"lib": ["ESNext"],
44
"module": "ESNext",
55
"target": "ESNext",
6-
"moduleResolution": "bundler",
6+
"moduleResolution": "Node",
77
"moduleDetection": "force",
88
"allowImportingTsExtensions": true,
99
"noEmit": true,

0 commit comments

Comments
 (0)