agentleFS
Microsoft AzureKnown publisherAzure/cosmos-explorer/.github/skills/run-unit-tests/SKILL.md

run-unit-tests

Skill131 starsChanged 7 months agoMITView on GitHub

Run unit tests for the Cosmos Explorer project. Use this skill when asked to run tests, check test results, or debug test failures.

  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 8 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the following commands to run unit tests for the Cosmos Explorer project.

    line 9
  2. Very specific:

    Before running tests, check whether npm install needs to be run:

    line 13
  3. Distinctive:

    Always run this check before proceeding with any test command.

    line 31
  4. Distinctive:

    Run the full test suite with coverage:

    line 35
  5. Distinctive:

    Run a specific test file without coverage (faster):

    line 45
  6. Distinctive:

    Run tests serially (useful for debugging flaky or interdependent tests):

    line 53
  7. Distinctive:

    Run only tests whose names match a pattern:

    line 61
  8. Very specific:

    When asked to simply "run tests" or "test", run npm test for the full suite.

    line 69
  9. Very specific:

    When asked to test a specific file or component, use npm run test:file -- <path>.

    line 70
  10. Very specific:

    When debugging test failures, use npm run test:debug to run serially.

    line 71
  11. Very specific:

    Use @testing-library/react for new component tests.

    line 74
  12. Very specific:

    Use Jest built-in mocking, not sinon.js.

    line 75
  13. Distinctive:

    If tests fail, read the error output carefully.

    line 77
  14. Distinctive:

    Mock issues: Ensure mocks are set up correctly and reset between tests.

    line 79
  15. Very specific:

    Import errors: Check that module name mappings in jest.config.js are correct.

    line 80
  16. Very specific:

    Type errors in tests: Run npm run compile to check for TypeScript issues.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Skill

Use the following commands to run unit tests for the Cosmos Explorer project.

Pre-Test: Check Dependencies

Before running tests, check whether npm install needs to be run:

if [ ! -d node_modules ] || [ package.json -nt node_modules ] || [ package-lock.json -nt node_modules ]; then
  npm install
fi

On Windows PowerShell:

if (-not (Test-Path node_modules) -or
    (Get-Item package.json).LastWriteTime -gt (Get-Item node_modules).LastWriteTime -or
    (Get-Item package-lock.json).LastWriteTime -gt (Get-Item node_modules).LastWriteTime) {
    npm install
}

Always run this check before proceeding with any test command.

Run All Unit Tests

Run the full test suite with coverage:

npm test

This clears the coverage/ directory and runs Jest with coverage collection enabled.

Run a Single Test File

Run a specific test file without coverage (faster):

npm run test:file -- path/to/file.test.ts

Run Tests in Debug Mode

Run tests serially (useful for debugging flaky or interdependent tests):

npm run test:debug

Run Tests Matching a Pattern

Run only tests whose names match a pattern:

npx jest --coverage=false --testPathPattern="SomeComponent"

Guidelines

  • When asked to simply "run tests" or "test", run npm test for the full suite.
  • When asked to test a specific file or component, use npm run test:file -- <path>.
  • When debugging test failures, use npm run test:debug to run serially.
  • Unit test files live adjacent to source files (Foo.test.ts next to Foo.ts in src/).
  • Tests use Jest with jest-environment-jsdom.
  • Use @testing-library/react for new component tests. Do not use Enzyme for new tests.
  • Use Jest built-in mocking, not sinon.js.
  • Coverage thresholds are enforced globally: branches 25%, functions 24%, lines 28%, statements 28%.
  • If tests fail, read the error output carefully. Common issues include:
    • Snapshot mismatches: Review the diff. If the change is intentional, update snapshots with npx jest --updateSnapshot.
    • Mock issues: Ensure mocks are set up correctly and reset between tests.
    • Import errors: Check that module name mappings in jest.config.js are correct.
    • Type errors in tests: Run npm run compile to check for TypeScript issues.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.