Skip to content

Commit

Permalink
test: add test code (#30)
Browse files Browse the repository at this point in the history
* test: update test code
* chore(action): update workflow code
* chore: update .gitignore to exclude jest coverage and junit.xml
  • Loading branch information
code-xhyun authored May 8, 2024
1 parent 918bea9 commit 2552fba
Show file tree
Hide file tree
Showing 13 changed files with 5,617 additions and 3,060 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
},
"overrides": [
{
"files": ["*.test.ts"],
"files": ["*.spec.ts"],
"env": {
"mocha": true
"jest": true
},
"rules": {
"@typescript-eslint/no-unused-expressions": "off",
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test Coverage Comment
on:
pull_request:
types: [opened, reopened,assigned,edited,review_requested,synchronize]
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: npm ci

- name: Run tests
run: |
npx jest --detectOpenHandles --forceExit --coverage --coverageReporters json-summary
- name: Jest Coverage Comment
id: coverageComment
uses: MishaKav/jest-coverage-comment@main
with:
junitxml-title: Pulse Test Report
junitxml-path: ./junit.xml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,6 @@ dist
coverage


_README.md
# jest
coverage
junit.xml
13 changes: 0 additions & 13 deletions .mocharc.jsonc

This file was deleted.

7 changes: 7 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Config } from '@jest/types';
// Sync object
const config: Config.InitialOptions = {
preset: 'ts-jest',
reporters: ['default', 'jest-junit'],
};
export default config;
Loading

1 comment on commit 2552fba

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines Statements Branches Functions
Coverage: 51%
53.65% (543/1012) 38.79% (116/299) 46.79% (73/156)

Pulse Test Report

Tests Skipped Failures Errors Time
45 0 💤 0 ❌ 0 🔥 9.05s ⏱️

Please sign in to comment.