Skip to content

Commit

Permalink
[test] Enable test coverage for @toolpad/core (#3697)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot authored Jun 21, 2024
1 parent 5740a51 commit 4476e5f
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: 2.1
orbs:
codecov: codecov/[email protected]

default-job: &default-job
working_directory: /tmp/mui-toolpad
Expand Down Expand Up @@ -164,6 +166,7 @@ jobs:
- run:
name: Tests fake browser
command: pnpm test
- codecov/upload

test_unit_browser:
<<: *default-job
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ test-results
.github/styles/Google
.github/styles/MUI
.github/styles/.vale-config

.coverage
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%
patch: off
comment: false
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@types/yargs": "17.0.32",
"@typescript-eslint/eslint-plugin": "7.12.0",
"@typescript-eslint/parser": "7.12.0",
"@vitest/coverage-v8": "beta",
"babel-plugin-react-remove-properties": "0.3.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chalk": "5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"dev": "concurrently \"pnpm build:stable --watch\" \"pnpm build:types --watch --preserveWatchOutput\"",
"check-types": "tsc --noEmit",
"test": "vitest run",
"test": "vitest run --coverage",
"test:dev": "vitest",
"test:browser": "vitest run --browser.enabled",
"test:browser:dev": "vitest --browser.enabled"
Expand Down
5 changes: 5 additions & 0 deletions packages/toolpad-core/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ export default defineConfig({
provider: 'playwright',
headless: !!process.env.CI,
},
coverage: {
exclude: ['./build/**'],
reportsDirectory: './.coverage',
reporter: ['text', 'lcov'],
},
},
});
2 changes: 1 addition & 1 deletion packages/toolpad-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"build": "tsup",
"dev": "tsup --watch",
"check-types": "tsup && tsc --noEmit",
"test": "vitest run"
"test": "vitest run --coverage"
},
"bugs": {
"url": "https://github.com/mui/mui-toolpad/issues"
Expand Down
5 changes: 5 additions & 0 deletions packages/toolpad-utils/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
setupFiles: ['../../test/setupVitest.ts'],
coverage: {
exclude: ['./dist/**'],
reportsDirectory: './.coverage',
reporter: ['text', 'lcov'],
},
},
});
Loading

0 comments on commit 4476e5f

Please sign in to comment.