Skip to content

[Test]: Several edge cases are missing from copilot-rule.test.ts #12

@flanny7

Description

@flanny7

Hello, I always appreciate rulesync.

Problem

While copilot-rule.test.ts is fairly comprehensive at 1,133 lines, I found several edge cases that are not covered and could hide existing bugs.

Missing Test Cases

1. Complex comma-separated glob patterns in applyTo

The current test for applyTo splitting covers a simple single-pattern case. The following patterns are untested:

  • Multiple patterns: "src/**/*.ts,tests/**/*.test.ts"
  • Patterns with surrounding whitespace: "*.ts , *.js" (trimming)
  • Duplicate patterns: "*.ts,*.ts"
  • Special characters: "src/{components,utils}/**/*.ts"

2. excludeAgent: "code-review" roundtrip

Only excludeAgent: "coding-agent" is tested in roundtrip scenarios. The "code-review" value lacks equivalent coverage.

3. applyTo being undefined or empty string

The behavior when applyTo is absent or empty is not explicitly tested. Expected: globs should be undefined.

4. Global mode + non-root path combination

getSettablePaths({ global: true }) is tested for the root file, but the non-root path (.copilot/instructions/) is not verified.

5. YAML serialization of special characters in description

The description field is not tested with values containing quotes, newlines, or Markdown syntax (# Heading), which can affect YAML serialization behavior.

Reference

Similar patterns are tested in cursor-rule.test.ts (e.g., complex globs at line 391, empty globs at line 232–249), which may serve as a reference for what to add here.

Your consideration would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions