Skip to content

Conversation

@SoonIter
Copy link
Member

@SoonIter SoonIter commented Jan 9, 2026

Summary

Related issues

AI Summary


Changes Made

Added E2E testing for rspress-plugin-supersub using Playwright, following the same pattern established in rspress-plugin-katex.

What was added

  • packages/rspress-plugin-supersub/index.spec.ts: E2E test file with two test cases:
    • should render superscript with <sup> tag - Verifies that ^..^ syntax renders as <sup> elements
    • should render subscript with <sub> tag - Verifies that _..._ syntax renders as <sub> elements

Implementation Details

  • Uses shared utility functions from e2e/utils.ts (runDevCommand, killProcess)
  • Starts a dev server before tests and cleanly shuts it down after
  • Tests verify the plugin correctly transforms markdown superscript/subscript syntax into proper HTML <sup> and <sub> tags

This PR was written using Vibe Kanban


## 创建的文件

### 1. `packages/rspress-plugin-supersub/index.spec.ts`

E2E 测试文件,包含两个测试用例:
- `should render superscript with <sup> tag` - 验证 `^..^` 语法渲染为 `<sup>` 标签
- `should render subscript with <sub> tag` - 验证 `_..._` 语法渲染为 `<sub>` 标签

测试使用 `e2e/utils.ts` 中的公共函数 `runDevCommand` 和 `killProcess`。

### 2. `packages/rspress-plugin-supersub/vitest.config.ts`

Vitest 配置文件,排除 `*.spec.ts` 文件(这些由 Playwright 处理,不由 Vitest 运行)。

## 已有的公共函数

项目已有 `e2e/utils.ts` 提供了公共函数:
- `runDevCommand(root, port?)` - 启动 `rspress dev`
- `runBuildCommand(root)` - 执行 `rspress build`
- `runPreviewCommand(root, port?)` - 启动 `rspress preview`
- `killProcess(instance)` - 关闭进程
- `getRandomPort()` - 获取随机可用端口

## 运行测试

```bash
# 运行所有 E2E 测试
pnpm e2e

# 仅运行 supersub 的测试
pnpm playwright test packages/rspress-plugin-supersub/index.spec.ts
```
@SoonIter SoonIter changed the title 给 supersub 增加 index.spec.ts 用于 e2e (vibe-kanban) test(rspress-plugin-supersub): add e2e test with playwright Jan 9, 2026
@SoonIter SoonIter merged commit f2e34b7 into main Jan 9, 2026
2 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/4ea0-supersub-index-s branch January 9, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants