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
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- buildSkill
- dev-serverSkill
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
- Distinctive: line 9
Use the following commands to run unit tests for the Cosmos Explorer project.
- Very specific: line 13
Before running tests, check whether npm install needs to be run:
- Distinctive: line 31
Always run this check before proceeding with any test command.
- Distinctive: line 35
Run the full test suite with coverage:
- Distinctive: line 45
Run a specific test file without coverage (faster):
- Distinctive: line 53
Run tests serially (useful for debugging flaky or interdependent tests):
- Distinctive: line 61
Run only tests whose names match a pattern:
- Very specific: line 69
When asked to simply "run tests" or "test", run npm test for the full suite.
- Very specific: line 70
When asked to test a specific file or component, use npm run test:file -- <path>.
- Very specific: line 71
When debugging test failures, use npm run test:debug to run serially.
- Very specific: line 74
Use @testing-library/react for new component tests.
- Very specific: line 75
Use Jest built-in mocking, not sinon.js.
- Distinctive: line 77
If tests fail, read the error output carefully.
- Distinctive: line 79
Mock issues: Ensure mocks are set up correctly and reset between tests.
- Very specific: line 80
Import errors: Check that module name mappings in jest.config.js are correct.
- Very specific: line 81
Type errors in tests: Run npm run compile to check for TypeScript issues.
≈ “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.
Files
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
fiOn 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 testThis 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.tsRun Tests in Debug Mode
Run tests serially (useful for debugging flaky or interdependent tests):
npm run test:debugRun 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 testfor 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:debugto run serially. - Unit test files live adjacent to source files (
Foo.test.tsnext toFoo.tsinsrc/). - Tests use Jest with
jest-environment-jsdom. - Use
@testing-library/reactfor 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.jsare correct. - Type errors in tests: Run
npm run compileto check for TypeScript issues.
- Snapshot mismatches: Review the diff. If the change is intentional, update snapshots with
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
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.

