Cursor rule
.cursor/rules/miniapp-test.mdcSmartUI 组件测试规范(jest + miniprogram-simulate)
Cursor rules
Quality
63/100
Scores the file, not the repository.Length
89 words
5 headings · 1 code blocksRepository
2
— · pushed 2 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# 测试约定89## 工具与入口1011- 使用 `miniprogram-simulate`:`simulate.load(demo/index, { rootPath })`、`simulate.render(id)`、`comp.attach(parent)`、`comp.toJSON()`、`toMatchSnapshot()`。12- 入口为各组件下的 `demo/index`,rootPath 为包根目录。1314## 标准 demo 快照写法1516```typescript17import path from 'path';18import simulate from 'miniprogram-simulate';1920test('should render demo and match snapshot', () => {21 const id = simulate.load(path.resolve(__dirname, '../demo/index'), {22 rootPath: path.resolve(__dirname, '../../'),23 });24 const comp = simulate.render(id);25 comp.attach(document.createElement('parent-wrapper'));26 expect(comp.toJSON()).toMatchSnapshot();27});28```2930## 文件约定3132- 每个组件至少有 `test/demo.spec.ts` 做 demo 快照。33- 逻辑复杂、快照覆盖不全时,增加 `test/index.spec.ts` 做单测。34- 修改 demo 后需跑 `yarn test`,必要时执行 `npx jest -u` 更新快照;若更新快照报错,需先修正测试 直到快照可正常生成。3536## 命令3738- `yarn test`:跑全量测试39- `yarn test:cover`:跑测试并算覆盖率40- `npx jest -u`:更新快照41
Also in Tuya-Community/miniapp-smart-ui
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Tuya-Community/miniapp-smart-ui.cursor/rules/wxs-es5.mdc · 2 | Cursor rules | no sections | 39/100 | 3 days ago | |
| Tuya-Community/miniapp-smart-ui.cursor/rules/component-structure.mdc · 2 | Cursor rules | no sections | 38/100 | 3 days ago | |
| Tuya-Community/miniapp-smart-ui.cursor/rules/demo-and-i18n.mdc · 2 | Cursor rules | testdocs | 50/100 | 3 days ago | |
| Tuya-Community/miniapp-smart-uiAGENTS.md · 2 | AGENTS.md | setuptest | 34/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
