RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/Tuya-Community/miniapp-smart-ui

Cursor rule

.cursor/rules/miniapp-test.mdc

SmartUI 组件测试规范(jest + miniprogram-simulate)

Cursor rules

Quality

63/100

Scores the file, not the repository.

Length

89 words

5 headings · 1 code blocks

Repository

2

— · pushed 2 days ago

Last changed

3 days ago

First indexed 3 days ago.
Tuya-Community/miniapp-smart-ui/.cursor/rules/miniapp-test.mdcRawGitHub
1---
2description: SmartUI 组件测试规范(jest + miniprogram-simulate)
3globs: packages/**/test/**/*.spec.ts
4alwaysApply: false
5---
6 
7# 测试约定
8 
9## 工具与入口
10 
11- 使用 `miniprogram-simulate`:`simulate.load(demo/index, { rootPath })`、`simulate.render(id)`、`comp.attach(parent)`、`comp.toJSON()`、`toMatchSnapshot()`。
12- 入口为各组件下的 `demo/index`,rootPath 为包根目录。
13 
14## 标准 demo 快照写法
15 
16```typescript
17import path from 'path';
18import simulate from 'miniprogram-simulate';
19 
20test('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```
29 
30## 文件约定
31 
32- 每个组件至少有 `test/demo.spec.ts` 做 demo 快照。
33- 逻辑复杂、快照覆盖不全时,增加 `test/index.spec.ts` 做单测。
34- 修改 demo 后需跑 `yarn test`,必要时执行 `npx jest -u` 更新快照;若更新快照报错,需先修正测试 直到快照可正常生成。
35 
36## 命令
37 
38- `yarn test`:跑全量测试
39- `yarn test:cover`:跑测试并算覆盖率
40- `npx jest -u`:更新快照
41 

Commands it names

  • yarn test
  • npx jest -u
  • yarn test:cover

Sections

  • 测试约定
  • 工具与入口
  • 标准 demo 快照写法
  • 文件约定
  • 命令

What it covers

test

Stack — with the evidence

typescript

(1.00)

jest

(1.00)

vue

(0.70)

javascript

(0.60)

eslint

(0.60)

github-actions

(0.60)

Glob targeting

  • packages/**/test/**/*.spec.ts

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
Tuya-Community
Language
—
License
—
Archived
no

All configs in this repo

Also in Tuya-Community/miniapp-smart-ui

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
Tuya-Community/miniapp-smart-ui.cursor/rules/wxs-es5.mdc · 2Cursor rulestypescriptjest+4no sections39/1003 days ago
Tuya-Community/miniapp-smart-ui.cursor/rules/component-structure.mdc · 2Cursor rulestypescriptjest+4no sections38/1003 days ago
Tuya-Community/miniapp-smart-ui.cursor/rules/demo-and-i18n.mdc · 2Cursor rulestypescriptjest+4testdocs50/1003 days ago
Tuya-Community/miniapp-smart-uiAGENTS.md · 2AGENTS.mdtypescriptjest+4setuptest34/1003 days ago
Diff against .cursor/rules/wxs-es5.mdc Diff against .cursor/rules/component-structure.mdc Diff against .cursor/rules/demo-and-i18n.mdc Diff against AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack