Preface¶
The plugin ecosystem of DeepSeek Harness (DSH) follows the philosophy of “everything is a plugin.” The community directory is an independent site and does not represent an official affiliation with DeepSeek or DeepSeek’s parent company, nor does it serve as an official app store.
A common issue when writing code in DSH is that code is generated, but tests are not generated, run, and fixed. bujue600-arch/dsh-testgen addresses this problem by providing a /testgen command and a generate_tests tool to scaffold unit test generation, invoke the project’s test runner, and fix tests within bounded iterations until they pass.
What This Is¶
dsh-testgen is a DeepSeek Harness plugin maintained by bujue600-arch, licensed under MIT.
Its one-line positioning: providing automated unit test generation for DeepSeek Harness, including the /testgen command and the generate_tests tool, for scaffolding, running, and fixing tests until they pass.
Core Features¶
/testgen Command¶
/testgen is a human-facing slash command.
Verified capabilities include:
- Supports
[options] <file-or-glob>. - Supports
--json. - Supports
--help. - Results are rendered directly in the Web UI.
generate_tests Tool¶
generate_tests is a model-facing tool for agents within DSH to invoke.
Verified capabilities include:
- Uses structured JSON input and output.
- Supports cooperative cancellation.
- Does not run in parallel.
Two Types of Generators¶
dsh-testgen provides two generation paths:
-
LLM generator: streams generation via
ctx.llm, follows the current provider/model, and applies bounded truncation to source input. -
Template generator: scaffolds zero-dependency smoke tests from exported symbols, requiring no API key.
Generate, Run, and Fix¶
The core flow of dsh-testgen is: generate tests → run tests → parse failures → fix tests.
Verified capabilities include:
- Generate → run → fix loop.
- Failure parsing for different test frameworks.
- Fix iterations bounded by
maxIterations. - Test runner auto-detects
vitest,jest, andmocha. - Falls back to
node --testas a generic fallback when the framework cannot be identified.
Configuration and Lifecycle¶
Verified capabilities include:
- A
testgenconfiguration section exists insettings.yaml. - Config edits take effect on the next invocation without requiring a restart.
- Registrations and in-progress runs are cleaned up with the plugin fiber.
- Refuses to overwrite existing user tests.
Implementation Quality¶
Verified facts also mention:
- End-to-end TypeScript implementation.
- Uses schemastery for configuration.
- Provides stable error codes.
- Includes 78 unit tests, including one real end-to-end run.
Installation and Enablement¶
Using dsh-testgen requires the following:
- Node ≥ 22.
dsh, the DeepSeek Harness CLI.
Installation command:
dsh plugin --profile web add github:bujue600-arch/dsh-testgen
This command installs the plugin into the web profile.
Verified facts also mention:
- The npm package will be published alongside the first stable
dshrelease it targets; pinning to the release tag is recommended at that time. - When installing via git or file paths,
pnpmmay return a non-zero exit code due to linked dependencies missing peers; this is a documented expectation, and the harness resolves peer packages from the profile’s own module fallback at startup, so the plugin still loads.
Typical Usage¶
Slash Command¶
The following commands come from verified usage examples:
/testgen src/utils/math.ts
/testgen --runner vitest "src/**/*.ts"
/testgen --generator template --no-run src/app.ts
/testgen --model deepseek-official/deepseek-chat src/parser.ts
Model Tool¶
Agents can also invoke the generate_tests tool directly. Example:
generate_tests({ target: "src/utils/math.ts", runner: "vitest", maxIterations: 3 })
Generation Location and Overwrite Policy¶
Verified facts state:
- For
src/utils/math.ts, the test file will be placed atsrc/utils/__tests__/math.test.ts. - When using
node:test, the file extension is.test.mts. - Existing test files will not be overwritten.
- If a test file already exists for the target, that target is skipped with a warning.
Suitable Scenarios and Notes¶
Suitable for these scenarios:
-
You are using DSH and want the agent to complete the unit test loop after writing code.
-
Your project uses
vitest,jest,mocha, ornode --test. -
You want test generation, test running, and failure fixes to all happen within the DSH session.
-
You want existing test files preserved.
Things to note:
dsh-testgenruns with the permissions of the currentdshprocess; review the source code and license before installation.- It does not overwrite existing test files; instead, it skips the target and issues a warning.
- The fix loop is bounded by
maxIterations, not an infinite retry. - The runtime requires Node ≥ 22 and
dsh. - The current documentation declares
@deepseek-ai/cordis ^4.0.1as a peer dependency; thepeerDependenciessection inpackage.jsonis marked as truncated in verified facts, and the full list should not be inferred from it.
Conclusion¶
The value of dsh-testgen lies in bringing unit tests into the DSH agent workflow: a /testgen command for humans, a generate_tests tool for models, and a complete generate-run-fix cycle within bounded iterations.
Related links:
- GitHub: https://github.com/bujue600-arch/dsh-testgen
- Directory page lead (this URL is marked in verified facts as derived only from plugin clues and was not verified in the provided sources): https://www.skillhub.cn/plugins/bujue600-arch/dsh-testgen