Skip to content

Commit

Permalink
test: Run tests with Jest and collect coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Jun 13, 2024
1 parent 1ea88df commit 2041e17
Show file tree
Hide file tree
Showing 21 changed files with 7,577 additions and 4,365 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "./node_modules/gts/"
"extends": "./node_modules/gts/",
"rules": {
"@typescript-eslint/no-unused-vars": "error"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Build
run: npm run compile
- name: LDWorkbench init & test run
run: rm -rf ./pipelines && npx ld-workbench --init && npx ld-workbench -c "src/utils/tests/static/single/conf.yml"
run: rm -rf ./pipelines && npx ld-workbench --init && npx ld-workbench -c "test/utils/static/single/conf.yml"
- name: Test
run: npm run test
- run: echo "Job status ${{ job.status }}."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
coverage/
node_modules/
.eslintcache
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/tests
.github
.husky
.vscode
Expand All @@ -8,4 +7,5 @@ static/ao
static/figures
static/tests
tsconfig.json
test/
.eslintrc.json
23 changes: 23 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
collectCoverage: true,
collectCoverageFrom: [
'**/src/**/*.ts', // Include files that are not covered by tests.
'!**/src/**/*.d.ts', // Don't show d.ts files on code coverage overview.
],
coverageReporters: ['json-summary', 'text'],
coverageThreshold: {
global: {
lines: 65.49,
statements: 64.98,
branches: 56.08,
functions: 71.15,
},
},
transform: {
'^.+\\.ts$': '@swc/jest',
},
};
Loading

0 comments on commit 2041e17

Please sign in to comment.