File tree 4 files changed +321
-18
lines changed
4 files changed +321
-18
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ jobs:
34
34
echo "NODE_ENV=test" >> packages/core/.env.test
35
35
36
36
- name : Run tests
37
- run : cd packages/core && pnpm test
37
+ run : cd packages/core && pnpm test:coverage
38
38
39
39
- name : Build packages
40
40
run : pnpm run build
41
41
42
42
- name : Upload coverage reports to Codecov
43
43
uses : codecov/codecov-action@v5
44
44
with :
45
- token : ${{ secrets.CODECOV_TOKEN }}
45
+ token : ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change 12
12
"dev" : " tsup --format esm --dts --watch" ,
13
13
"build:docs" : " cd docs && pnpm run build" ,
14
14
"test" : " vitest run" ,
15
+ "test:coverage" : " vitest run --coverage" ,
15
16
"test:watch" : " vitest"
16
17
},
17
18
"author" : " " ,
34
35
"@types/wav-encoder" : " 1.3.3" ,
35
36
"@typescript-eslint/eslint-plugin" : " 8.12.2" ,
36
37
"@typescript-eslint/parser" : " 8.12.2" ,
38
+ "@vitest/coverage-v8" : " 2.1.5" ,
37
39
"dotenv" : " 16.4.5" ,
38
40
"eslint" : " 9.13.0" ,
39
41
"eslint-config-prettier" : " 9.1.0" ,
Original file line number Diff line number Diff line change @@ -34,8 +34,16 @@ for package in "${PACKAGES[@]}"; do
34
34
cd " $package_path " || continue
35
35
36
36
if [ -f " package.json" ]; then
37
- # Run tests if available
38
- if npm run | grep -q " test" ; then
37
+ # Run tests with coverage if TEST_COVERAGE is set and test:coverage script exists
38
+ if [[ -n " $TEST_COVERAGE " ]] && npm run | grep -q " test:coverage" ; then
39
+ echo -e " \033[1mRunning coverage tests for package: $package \033[0m"
40
+ if npm run test:coverage; then
41
+ echo -e " \033[1;32mSuccessfully tested $package with coverage\033[0m\n"
42
+ else
43
+ echo -e " \033[1;31mCoverage tests failed for $package \033[0m"
44
+ fi
45
+ # Otherwise, run regular tests if available
46
+ elif npm run | grep -q " test" ; then
39
47
echo -e " \033[1mRunning tests for package: $package \033[0m"
40
48
if npm run test ; then
41
49
echo -e " \033[1;32mSuccessfully tested $package \033[0m\n"
@@ -52,4 +60,4 @@ for package in "${PACKAGES[@]}"; do
52
60
cd - > /dev/null || exit
53
61
done
54
62
55
- echo -e " \033[1mTest process completed.😎\033[0m"
63
+ echo -e " \033[1mTest process completed.😎\033[0m"
You can’t perform that action at this time.
0 commit comments