Skip to content

Commit

Permalink
add test coverage report (refinedev#294)
Browse files Browse the repository at this point in the history
* add test coverage report

* add npm install step for test

* fix field BaseRecord import

* update pull-request action

* update jest for coverage all packages

* update jest coverage action

* update pull-request action

* update pull request action

* update github token

* fix package.json test script

* fix filefield record ts error

* fix example app build

* update jest coverage commenter

* jest coverage test dummy commit

* add coverage folder .gitignore
  • Loading branch information
Ömer Faruk APLAK authored Apr 1, 2021
1 parent 9e0d86a commit 965234c
Show file tree
Hide file tree
Showing 10 changed files with 17,104 additions and 6 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ on:
- reopened

jobs:
test-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v1
- name: npm install
run: |
npm install
npm run lerna bootstrap
- uses: dkershner6/jest-coverage-commenter-action@v1
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
test_command: npm run test:coverage
example-web:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
node-version: [14.x]

steps:
- name: Workflow run cleanup action
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist
.rpt2_cache
.vscode
.husky
coverage

# misc
.DS_Store
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ npm run start
## License

MIT © [pankod](https://github.com/pankod)

4 changes: 2 additions & 2 deletions example/src/components/pages/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const FilesList = (props: any) => {
render={(value, record) => (
<FileField
download
record={record}
record={record as any}
value={value}
title={translate(
"common:resources.files.forms.title",
Expand All @@ -64,7 +64,7 @@ export const FilesList = (props: any) => {
render={(value, record) => {
return (
<FileField
record={record}
record={record as any}
value={value}
src="url"
title="title"
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
projects: ["<rootDir>/packages/*/jest.config.js"],
coverageDirectory: "<rootDir>/coverage/",
};
17,069 changes: 17,069 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lerna": "lerna",
"start": "lerna run start --stream --parallel",
"test": "lerna run test",
"test:coverage": "jest --runInBand --silent --ci --coverage",
"lint": "tsdx lint packages example",
"lint:fix": "npm run lint -- packages example --quiet --fix --allow-empty",
"build": "lerna run build",
Expand Down Expand Up @@ -39,6 +40,7 @@
"@types/react-dom": "^17.0.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.8",
"jest": "^26.6.3",
"lerna": "^4.0.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
rootDir: "./",
globals: {
"ts-jest": {
tsconfig: "tsconfig.test.json",
tsconfig: "<rootDir>/tsconfig.test.json",
},
},
setupFilesAfterEnv: ["<rootDir>/test/jest.setup.ts"],
Expand All @@ -21,4 +21,6 @@ module.exports = {
...pathsToModuleNameMapper(paths, { prefix: "<rootDir>/" }),
"\\.css$": "identity-obj-proxy",
},
name: "core",
displayName: "core",
};
2 changes: 1 addition & 1 deletion packages/core/src/interfaces/field.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseRecord } from "@contexts/data/IDataContext";
import { BaseRecord } from "../interfaces";

type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<
T,
Expand Down
6 changes: 6 additions & 0 deletions packages/json-server/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: "ts-jest",
rootDir: "./",
name: "core",
displayName: "core",
};

0 comments on commit 965234c

Please sign in to comment.