Skip to content

Commit 7262777

Browse files
authored
Feat/cov (#7)
* feat(config): test & test:cov * refactor(cozeloop-ai): mock -> __mock__ * feat: upgrade axios version * feat: update license * feat(cozeloop-ai): improve ut * feat: codecov config v1 * fix(cozeloop-ai): remove only tests * feat: add codecov badage
1 parent 0fdb49b commit 7262777

File tree

32 files changed

+323
-75
lines changed

32 files changed

+323
-75
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,16 @@ jobs:
4242
- name: Install Dependencies
4343
run: node common/scripts/install-run-rush.js install
4444

45-
- name: Rush rebuild
45+
- name: Build All
4646
run: node common/scripts/install-run-rush.js rebuild --verbose --timeline
47+
48+
- name: Test:cov All
49+
run: node common/scripts/install-run-rush.js test:cov --verbose --timeline
50+
51+
- name: Upload to Codecov
52+
uses: codecov/codecov-action@v5
53+
with:
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
slug: coze-dev/cozeloop-js
56+
fail_ci_if_error: false
57+
verbose: true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Spring (SG) Pte. Ltd.
3+
Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# CozeLoop Monorepo
22

3+
[![codecov](https://codecov.io/gh/coze-dev/cozeloop-js/branch/main/graph/badge.svg)](https://codecov.io/gh/coze-dev/cozeloop-js)
34
[![CI](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml)
45

56
English | [简体中文](./README.zh-CN.md)

README.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# CozeLoop Monorepo
22

3+
[![codecov](https://codecov.io/gh/coze-dev/cozeloop-js/branch/main/graph/badge.svg)](https://codecov.io/gh/coze-dev/cozeloop-js)
34
[![CI](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/coze-dev/cozeloop-js/actions/workflows/ci.yml)
45

56
[English](./README.md) | 简体中文

codecov.yml

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# valid this file: curl --data-binary @codecov.yml https://codecov.io/validate
22
# reference doc: https://docs.codecov.com/docs/common-recipe-list#set-project-coverage-checks-on-a-pull-request
33

4-
# codecov:
5-
# require_ci_to_pass: false
6-
# notify:
7-
# wait_for_ci: false
4+
codecov:
5+
require_ci_to_pass: true
6+
notify:
7+
wait_for_ci: true
88

9-
# for overall project coverage
109
coverage:
1110
status:
1211
project:
@@ -16,7 +15,7 @@ coverage:
1615
patch:
1716
default:
1817
target: 90%
19-
threshold: 10%
18+
threshold: 5%
2019

2120
comment:
2221
layout: 'header, diff, components, files' # show component info in the PR comment
@@ -34,41 +33,10 @@ component_management:
3433
threshold: 1%
3534
- type: patch
3635
target: 90%
37-
threshold: 10%
36+
threshold: 5%
3837

3938
individual_components:
40-
- component_id: cozeloop-ai # this is an identifier that should not be changed
41-
name: cozeloop-ai # this is a display name, and can be changed freely
39+
- component_id: cozeloop-ai
40+
name: '@cozeloop/ai'
4241
paths:
4342
- packages/cozeloop-ai/**
44-
statuses:
45-
- type: project
46-
target: 90%
47-
threshold: 1%
48-
- type: patch
49-
target: 90%
50-
threshold: 10%
51-
52-
- component_id: realtime-api # this is an identifier that should not be changed
53-
name: realtime-api # this is a display name, and can be changed freely
54-
paths:
55-
- packages/realtime-api/**
56-
statuses:
57-
- type: project
58-
target: 90%
59-
threshold: 1%
60-
- type: patch
61-
target: 90%
62-
threshold: 10%
63-
64-
- component_id: chat-sdk # this is an identifier that should not be changed
65-
name: chat-sdk # this is a display name, and can be changed freely
66-
paths:
67-
- packages/chat-sdk/**
68-
statuses:
69-
- type: project
70-
target: 20%
71-
threshold: 1%
72-
- type: patch
73-
target: 0%
74-
threshold: 1%

common/config/rush/command-line.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@
2626
"safeForSimultaneousRushProcesses": true,
2727
"autoinstallerName": "rush-commitlint",
2828
"shellCommand": "commitlint"
29+
},
30+
{
31+
"commandKind": "bulk",
32+
"name": "test",
33+
"description": "Executes automated tests.",
34+
"allowWarningsInSuccessfulBuild": true,
35+
"ignoreMissingScript": true,
36+
"enableParallelism": true,
37+
"summary": "⭐️️ Run test command for each package"
38+
},
39+
{
40+
"commandKind": "bulk",
41+
"name": "test:cov",
42+
"allowWarningsInSuccessfulBuild": true,
43+
"description": "Executes automated tests with coverage collection.",
44+
"ignoreMissingScript": true,
45+
"enableParallelism": true,
46+
"incremental": true,
47+
"ignoreDependencyOrder": true,
48+
"safeForSimultaneousRushProcesses": true,
49+
"summary": "⭐️️ Run coverage command for each package"
2950
}
3051
// {
3152
// /**

common/config/rush/pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/eslint-config/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"build": "tsc -b tsconfig.json",
1313
"dev": "npm run build -- -w",
1414
"lint": "eslint ./ --cache --quiet",
15-
"test": "exit",
16-
"test:cov": "exit"
15+
"test": "exit 0",
16+
"test:cov": "exit 0"
1717
},
1818
"dependencies": {
1919
"@babel/eslint-parser": "~7.25.8",
@@ -34,9 +34,9 @@
3434
"@babel/plugin-syntax-jsx": "~7.23.3",
3535
"@babel/preset-env": "~7.20.2",
3636
"@babel/preset-react": "~7.13.13",
37-
"@loop-infra/ts-config": "workspace:*",
3837
"@eslint/compat": "~1.2.0",
3938
"@eslint/eslintrc": "~3.1.0",
39+
"@loop-infra/ts-config": "workspace:*",
4040
"@rushstack/eslint-config": "~3.1.1",
4141
"@stylistic/eslint-plugin-ts": "^2.8.0",
4242
"@typescript-eslint/eslint-plugin": "^8.5.0",

config/vitest-config/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"scripts": {
99
"build": "exit",
1010
"dev": "npm run build -- -w",
11-
"lint": "eslint ./ --cache --quiet"
11+
"lint": "eslint ./ --cache --quiet",
12+
"test": "exit 0",
13+
"test:cov": "exit 0"
1214
},
1315
"dependencies": {
1416
"vite-tsconfig-paths": "^4.2.1"

config/vitest-config/src/define-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { mergeConfig, type ViteUserConfig } from 'vitest/config';
22

3-
import { webPreset } from './preset-web.ts';
4-
import { nodePreset } from './preset-node.ts';
5-
import { defaultVitestConfig } from './preset-default.ts';
3+
import { webPreset } from './preset-web';
4+
import { nodePreset } from './preset-node';
5+
import { defaultVitestConfig } from './preset-default';
66

77
export interface VitestConfig extends ViteUserConfig {
88
/**

0 commit comments

Comments
 (0)