Skip to content

test: add local chat completions smoke test#388

Closed
SsuJojo wants to merge 2 commits intoicebear0828:masterfrom
SsuJojo:pr/local-chat-test
Closed

test: add local chat completions smoke test#388
SsuJojo wants to merge 2 commits intoicebear0828:masterfrom
SsuJojo:pr/local-chat-test

Conversation

@SsuJojo
Copy link
Copy Markdown
Collaborator

@SsuJojo SsuJojo commented Apr 15, 2026

Summary

  • add a local chat completions smoke test that exercises curl requests against /v1/chat/completions
  • register the test:local-chat script in package.json
  • include tests/local-chat in the Vitest file patterns

Test plan

  • Start the local proxy server on port 8080
  • Run npm run test:local-chat

@SsuJojo SsuJojo self-assigned this Apr 17, 2026
Copy link
Copy Markdown
Owner

@icebear0828 icebear0828 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非常感谢补充这个实用的冒烟测试脚本!整体出发点很好。

不过目前的实现有一个小问题会导致流水线阻塞:通过修改根目录的 vitest.config.ts 并加入 include 列表,这意味着 CI 自动执行默认的 npm run test 时也会被强行拉起这个测试。因为 CI 默认是裸机环境,在既没有环境变量注入也没有 mock 预制账户的情况下,这些写死的 gpt-5.4 测试会全部因为未能命中预置规则报 404 Not Found 而导致整个 CI 跑挂。

为了保持它作为一个按需、独立的 local 测试脚本,建议使用和仓库里 test:real 等命令一样的隔离规范

  1. 请撤销对根目录 vitest.config.ts 的所有修改。
  2. 参考项目原有的做法,在 tests/local-chat 目录下新建一个专门的配置文件 vitest.config.ts
  3. 然后将 package.json 中的脚本声明显式指向该配置:
    "test:local-chat": "vitest run --config tests/local-chat/vitest.config.ts"

这样就能完美把它剥离出默认的单测 CI 流水线,并保证开发者手工调用的有效性。期待你的修正!

@SsuJojo SsuJojo marked this pull request as draft April 17, 2026 12:20
@SsuJojo SsuJojo marked this pull request as ready for review April 17, 2026 12:25
@SsuJojo SsuJojo requested a review from icebear0828 April 17, 2026 12:25
@SsuJojo SsuJojo closed this Apr 18, 2026
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