Skip to content

Commit

Permalink
feat: add db debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang committed Dec 5, 2023
1 parent f153489 commit 4f968b2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 46 deletions.
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,4 @@
# Canyon [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/canyon-project/canyon/blob/main/LICENSE) [![build status](https://github.com/canyon-project/canyon/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/canyon-project/canyon/actions/workflows/ci.yml)
db,用脚本插入一下

👋 Canyon is a JavaScript code coverage solution
canyon,覆盖率数据根据分支、commit查询

![](./screenshots/overview1.jpg)

### **Introduction**

JavaScript 代码覆盖率解决方案。在前端工程构建阶段,将代码探针及工程信息插桩进产物中;在前端应用运行时,将内存中的覆盖率数据上报至服务端。支持覆盖率聚合、报告生成、新增行覆盖率。

主要用于端到端的UI测试用例覆盖率数据收集(也支持node或者UT覆盖率上报收集)。

### **Features**

**Bundling:** 多种生态的bundling方案。

- `vite` - vite-plugin-istanbul
- `babel` - babel-plugin-istanbul
- `swc` - swc-coverage-instrument

**React Native:** 支持React Native覆盖率数据收集。

**File:** 支持多种文件类型,例如js、jsx、ts、tsx。

**源码回溯:** 开启sourceMap选项来回溯源码覆盖率信息。

**CI** 提供覆盖率接口,方便CI工具集成。

**变更代码:** 通过配置想要对比的基线Commit Sha或者分支名,过滤筛选出变更代码文件的覆盖率以及计算出整体新增代码行覆盖率。

**Commit:** 使用oauth2登陆与github、gitlab等代码仓库链接,根据Commit Sha拉取代码进行覆盖率详情绘制。

**聚合:** 根据上报的报告ID进行实时聚合覆盖率数据聚合。

**报告组件:** 构建最小原生JavasScript的npm包,提供现代化前端报告水合方案以代替传统istanbul report。

**浏览器插件:** 提供浏览器插件,供开发人员实时检测应用覆盖率详情。

### Screenshots

![报告](./screenshots/report1.jpg)

![覆盖率](./screenshots/demo1.jpg)

![新增行](./screenshots/codechange1.jpg)

![配置](./screenshots/ci1.jpg)
18 changes: 17 additions & 1 deletion packages/canyon-backend/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get } from '@nestjs/common';
import { Body, Controller, Get, Post } from '@nestjs/common';
import { PrismaService } from './prisma/prisma.service';

@Controller()
Expand All @@ -10,6 +10,22 @@ export class AppController {
return '230614';
}

@Post('/api/db')
db(@Body() body): any {
if (body.type === 'create') {
// @ts-ignore
return this.prismaService[body.table].create(body.data);
} else if (body.type === 'delete') {
// @ts-ignore
return this.prismaService[body.table].delete({
where: {
id: body.id,
},
});
}
return {};
}

@Get('/api/base')
base(): any {
return {
Expand Down

0 comments on commit 4f968b2

Please sign in to comment.