SuperAPI AI Directory

webstrom-test-creator

Testing & quality

View repository

Updated 10-16 09:14

About this skill

WebStorm Test Creator

Create one TEST_FILE run configuration for each real test file in the target scope. Preserve the project's existing run conventions, replacing only the name, group, test path, and evidence-confirmed execution parameters with those of the current target.

Process guidance

[测试目录或 glob + folderName]
               |
               v
[读取仓库规则、模板、package.json 和 Vitest 配置]
               |
               v
[筛选真实测试文件,排除 schema / fixture / setup / helper]
               |
               v
[逐文件确认 project / options / env]
               |
               +-- 无法确认 --> [说明缺失的执行契约并停止]
               |
               +-- 已确认 ----> [读取 references 中的核心 XML 模板]
                                      |
                                      v
                         [处理名称冲突并写入 .run/*.run.xml]
                                      |
                                      v
                         [核对文件映射 -> XML 校验 -> diff 检查]

Workflow

  1. Read the repository rules, the user-specified .run template, thepackage.json test script, and the Vitest configuration.
  2. List files within the user-given directory or glob, and filter out real test files based on the Vitest include、exclude and the project's test naming conventions. Exclude schema, fixture, setup, and test helper modules.
  3. For each test file, confirm the corresponding Vitest project, command parameters, and environment variables.
  4. Prefer the user-specified template as the source; when no template is specified, read the core XML template in references/vitest-test-file.run.md .
  5. In the project root's .run/ , generate one configuration for each test file, and set folderName。
  6. Verify that the target test files correspond one-to-one with the new configurations, then check the XML and diff formatting.

Confirm execution parameters

Use the project include、exclude in the Vitest configuration as the primary evidence for file ownership, then use the package.json script and existing .run configurations to confirm command parameters and environment variables.

  • Ordinary unit or integration tests use the ordinary test project defined by the project.
  • *.e2e-spec.*、*.llm-spec.*、*.otel-spec.* and other dedicated tests use only the project corresponding to their naming and include rules.
  • When a file is included by both an ordinary project and an aggregate project, by default choose the most specific, lowest-cost project that matches the file's purpose; choose the aggregate project only when the user requests the full E2E suite.
  • folderName is only a WebStorm UI grouping and must not be used to infer the Vitest project.
  • Add environment variables only when the test script, Vitest configuration, or existing run configurations explicitly require them. Do not guess environment variables based on the project name.
  • Do not unconditionally copy the template's --project test、NODE_ENV or other test-specific parameters to all files.

When it cannot be confirmed from the repository which project a file belongs to, first explain to the user the missing execution contract; do not generate configurations that appear usable but actually run incorrectly.

Generate configurations

Extract the XML template from the reference text, preserve the runner type, Node interpreter, Vitest package location, working directory, and <method> version actually used by the project, and replace these dynamic fields:

Field Value
name Use the test file name by default; when names collide within the same folderName , add the shortest unique parent directory prefix
folderName Use the user-specified group name
vitest-options Use the parameters of the project to which the current test file belongs
envs Use the environment variables explicitly required by the current test command; when none are required, keep <envs />
scope-kind Use TEST_FILE
test-file Use $PROJECT_DIR$/ plus the repository-relative test path

Do not write the developer machine's absolute paths into SKILL.md, template, or generated .run configuration. Project files are uniformly located via $PROJECT_DIR$ .

Avoid overwriting configurations with the same name

By default, save the configuration as .run/<测试文件名>.run.xml。

  • When the target file already has a configuration, confirm that <test-file> points to the same file before updating the fields that need to change.
  • When the file name is already taken by another test, keep the existing configuration and add folderName or the shortest unique parent directory prefix to the new configuration file name.
  • When the same display name exists within the same folderName , also add the shortest unique parent directory prefix to name .
  • Do not modify unrelated run configurations, and do not change the user's existing staged state.

Verification

Before completion, confirm item by item:

  1. Re-list the test files included by Vitest within the target scope.
  2. Confirm that each target test file has exactly one file-level configuration created or updated this time.
  3. Confirm that all configurations use the user-specified folderName, and that <test-file> uses the $PROJECT_DIR$ relative path.
  4. Use xmllint --noout <配置文件...> to validate the XML; when the environment does not have xmllint , use an available XML parser.
  5. Run git diff --check。

for this configuration. Creating a manual debug configuration does not require executing the tests themselves. Unless the user requests otherwise, only report the generated configuration, project/env selection, and XML validation results.