Claude-skill-registry jest-config
Generates jest.config.cjs for unit testing configuration. Configures Jest with Vue, TypeScript support, coverage thresholds, and test environment settings.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/jest-config" ~/.claude/skills/majiayu000-claude-skill-registry-jest-config && rm -rf "$T"
skills/data/jest-config/SKILL.mdJest Config Skill
Purpose
Generate the
jest.config.cjs file for unit testing configuration with Jest.
⚠️ CONDITIONAL EXECUTION
This skill should ONLY be used if the project uses Jest instead of Vitest.
Test Framework Detection:
- Check
for test framework dependency:package.json- If
found → SKIP THIS SKILL (use vitest-config skill instead)"vitest" - If
found → EXECUTE THIS SKILL"jest" - If neither found → PROMPT USER: "Which test framework do you want to use: Jest or Vitest?"
- If
Note: Vitest is the officially recommended test framework for Vue 3 projects as of 2024+. Jest is considered legacy but still widely used.
🚨 MANDATORY FILE COUNT
This skill MUST create exactly 1 file:
(preferred format - CommonJS)jest.config.cjs
🔍 BEFORE GENERATING - CRITICAL RESEARCH REQUIRED
⚠️ HIGH PRIORITY: Verify current Jest ecosystem to prevent outdated configuration
Required Research Steps:
- Jest Version: Check current Jest version and configuration format
- Verify Jest is still maintained and supported
- Check if
format is still recommendedjest.config.cjs
- Vue 3 Jest Transformer: CRITICAL - Check if
is still maintained@vue/vue3-jest- Run:
npm view @vue/vue3-jest time - Check last publish date and maintenance status
- If deprecated or unmaintained:
- STOP and PROMPT USER: "@vue/vue3-jest appears unmaintained. Vitest is now recommended for Vue 3. Should we continue with Jest or switch to Vitest?"
- Wait for user decision before proceeding
- If maintained: Verify current version and compatibility with Jest 29+
- Run:
- Coverage Provider: Verify
vsv8
coverage providerbabel- Check if
is still recommended overv8babel - Verify compatibility with current Jest version
- Check performance and accuracy differences
- Check if
- TypeScript Support: Verify
transformerts-jest- Check if
is still maintainedts-jest - Verify compatibility with TypeScript and Jest versions
- Check if
- ESM Package Detection: Identify packages requiring transformation
- Check
for ESM-only packages (axios, date-fns, etc.)package.json - Research which packages need to be in
transformIgnorePatterns - Common ESM packages: axios, lodash-es, uuid (verify current list)
- Check
- Test Environment: Verify
is still recommendedjsdom- Check if
orjsdom
environment is appropriatenode - Verify
version compatibilityjsdom
- Check if
- File Format Options: Check if format is deprecated
- Verify
format is still preferred.cjs - Check
,.js
,.mjs
, package.json field alternatives.json
- Verify
Output
Create the file:
jest.config.cjs
Supported Format:
(strict preferred format - CommonJS, most compatible)jest.config.cjs
Alternative Formats (only if .cjs deprecated):
(JavaScript, follows package.json type)jest.config.js
(ES Module format)jest.config.mjs
(JSON format, limited functionality)jest.config.json
Example File
See:
examples.md in this directory for complete examples and detailed explanations.
⚠️ IMPORTANT: The examples.md file contains December 2025 configurations. Always verify current Jest ecosystem before using.
Execution Checklist
- Detect test framework from package.json (Jest vs Vitest)
- If Vitest detected, skip this skill entirely
- If Jest detected, proceed with research
- Research current Jest version and configuration format
- CRITICAL: Verify
maintenance status@vue/vue3-jest - If
unmaintained, prompt user for decision@vue/vue3-jest - Verify
transformer compatibilityts-jest - Research coverage provider (
vsv8
)babel - Detect ESM packages in package.json needing transformation
- Verify
test environment compatibilityjsdom - Create
with current standardsjest.config.cjs - Verify file format is still recommended (not deprecated)
🛑 BLOCKING VALIDATION CHECKPOINT
STOP! Before proceeding to the next skill, verify:
Automated Verification
Run this command to verify the file exists:
if [ -f "jest.config.cjs" ] || [ -f "jest.config.js" ] || [ -f "jest.config.mjs" ] || grep -q "\"jest\":" package.json 2>/dev/null; then echo "✓ Jest configuration found" if [ -f "jest.config.cjs" ]; then echo "✓ Using jest.config.cjs (preferred format)" fi # Check for Vitest conflict if grep -q "\"vitest\"" package.json 2>/dev/null; then echo "⚠ WARNING: Both Jest and Vitest detected in package.json" echo " Consider using only one test framework" fi else echo "✗ Jest configuration missing" exit 1 fi
Manual Verification
- ✓
exists at project rootjest.config.cjs - ✓ File uses CommonJS format (
)module.exports - ✓ File includes
for TypeScript supportpreset: 'ts-jest' - ✓ File includes
for DOM testingtestEnvironment: 'jsdom' - ✓ File includes Vue transformer (
- if maintained)@vue/vue3-jest - ✓
includes detected ESM packagestransformIgnorePatterns - ✓ Coverage provider is set (verify
orv8
)babel - ✓ Module name mapper includes path aliases (
→@/
)src/ - ✓ No Vitest configuration conflict in package.json
If Validation Fails
DO NOT PROCEED to the next skill. Create or fix the missing/incorrect file immediately.
Notes
- Conditional Execution: Only use if project uses Jest (not Vitest)
- Vitest Preferred: For new Vue 3 projects, Vitest is officially recommended
- Coverage Provider:
is faster and more accurate thanv8
(verify current recommendation)babel - Vue Transformer:
transforms Vue SFC files (check maintenance status)@vue/vue3-jest - TypeScript Support:
transforms TypeScript filests-jest - ESM Handling:
allows testing ESM packagestransformIgnorePatterns - Coverage Exclusions: Excludes infrastructure files (main.ts, router, services, etc.)
- Module Name Mapper: Handles
path aliases and asset imports@/ - Test Environment:
provides DOM APIs for component testingjsdom - Setup Files: Can configure test environment and globals
- Always verify current ecosystem - Jest/Vue testing landscape evolves
- CommonJS Format:
ensures compatibility with all module systems.cjs - Legacy Status: Jest is legacy for Vue 3; consider migrating to Vitest