R016

Detect invalid characters in ArkTS/TypeScript/JavaScript testcase names.

31|6|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill r016
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: R016
Source: https://github.com/openharmonyinsight/openharmony-skills/tree/main/skills/check-test-code-quality/rules/R016
Command: npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill r016

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents CI and review churn caused by ArkTS/TS/JS testcase names containing invalid characters by enforcing a strict, consistent naming rule.

Core Features & Use Cases

  • Automated testcase scanning: Checks only .test.ets, .test.ts, and .test.js files for it() first-argument names that contain disallowed characters.
  • Accurate issue reporting: Flags each offending testcase with file path, line number, snippet, and the rule ID.
  • Targeted repair guidance: Recommends removing invalid characters and appending an Adapt + three-digit suffix, and keeps @tc.name synchronized when present.
  • Use Case: Standardize a large ArkTS test suite where many it('test.name@001', ...) cases were copied with punctuation, so the pipeline stops warning and review feedback becomes actionable.

Quick Start

Ask the AI to run the R016 scan on your changed .test.ets, .test.ts, or .test.js files and output a list of naming violations with suggested fixed names.

Frequently Asked Questions about R016

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce valid characters in ArkTS testcase names during code review?

To enforce valid characters in ArkTS testcase names, scan `.test.ets`, `.test.ts`, and `.test.js` files to extract `it()` first arguments and match them against the `^[a-zA-Z0-9_-]+$` regex. This flags naming violations containing disallowed punctuation for CI quality gating.

What is the allowed character set for it() testcase names in ArkTS test suites?

The allowed character set for ArkTS `it()` testcase names strictly includes alphanumeric characters, underscores, and hyphens, validated using the `^[a-zA-Z0-9_-]+$` regex pattern. Any testcase name containing punctuation like periods or symbols violates this test suite hygiene rule.

Can I automatically fix invalid testcase names and synchronize the @tc.name annotation?

Yes, you can automatically fix invalid testcase names by removing disallowed characters and appending an `Adapt` plus three-digit suffix. During repair planning, the tool keeps the associated `@tc.name` synchronized when present in the test file.

Does static analysis for testcase naming apply to regular TypeScript source files?

No, static analysis for testcase naming does not apply to regular TypeScript source files. The scanning specifically targets test files with the `.test.ets`, `.test.ts`, and `.test.js` extensions to ensure it only evaluates `it()` testcase entries.

Why does my CI pipeline warn about copied it() testcase names containing punctuation?

Your CI pipeline warns about copied `it()` testcase names because static analysis detects characters outside the allowed alphanumeric, underscore, and hyphen set. Copied cases often retain punctuation like `@`, causing code review churn and failing the naming rule gate.