SNUTS.js - Test Smell Detector for VS Code
Automatically detect and fix test smells in your JavaScript and TypeScript test files.
SNUTS.js is a VS Code extension that helps you write better tests by identifying common code quality issues—known as "test smells"—in real-time. Powered by @snutsjs/core, this extension integrates seamlessly with your workflow to catch issues as you code.
What are Test Smells?
Test smells are patterns in test code that indicate potential quality issues, such as:
- Tests with anonymous logic (unclear test intent)
- Tests without proper descriptions
- Overly complex snapshot tests
- Conditional logic in tests
- Over-commented or under-described tests
Let SNUTS.js help you maintain clean, maintainable test suites.
Features
- ✨ Real-time Detection — Analyzes test files as you type (with configurable debounce)
- 🎯 In-Editor Diagnostics — See issues directly in your code with inline messages
- 📋 Problems Panel Integration — View all detected smells in VS Code's Problems panel
- ⚡ Manual Analysis — Run analysis on demand with a command
- 🎛️ Fully Configurable — Customize severity levels, file patterns, and detection debounce
- 🔄 Auto-Discovery — Automatically detects new detectors added to
@snutsjs/core
Installation
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X / Cmd+Shift+X)
- Search for "SNUTS.js"
- Click Install
Quick Start
- Open a TypeScript or JavaScript test file (any file matching
*.test.* or *.spec.*)
- The extension automatically analyzes the file and highlights test smells
- Hover over highlighted issues to see descriptions
- Review the Problems panel for all detected issues
You can also run analysis manually:
- Open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P)
- Run: SNUTS.js: Analyze Current Test File
Configuration
Customize SNUTS.js behavior via VS Code settings (Preferences: Open Settings):
Disable/Enable Detection
"snuts-js.enabled": true
Debounce Interval
Delay (in milliseconds) before running analysis after making edits:
"snuts-js.debounceMs": 500
File Patterns
Specify which test files to analyze (glob patterns):
"snuts-js.includePatterns": [
"**/*.test.ts",
"**/*.spec.ts",
"**/__tests__/**/*.ts"
]
Diagnostic Severity
Choose how smells are reported: error, warning, or information:
"snuts-js.severity": "warning"
Default File Patterns
If not configured, SNUTS.js analyzes files matching:
**/*.test.ts / **/*.test.tsx
**/*.spec.ts / **/*.spec.tsx
**/*.test.js / **/*.test.jsx
**/*.spec.js / **/*.spec.jsx
**/__tests__/**/*.ts / **/__tests__/**/*.tsx
**/__tests__/**/*.js / **/__tests__/**/*.jsx
Commands
| Command |
Description |
SNUTS.js: Analyze Current Test File |
Manually trigger analysis of the active test file |
Requirements
- VS Code:
^1.110.0
- Node.js:
>=18
- Test Files: JavaScript or TypeScript files matching configured patterns
Troubleshooting
Extension doesn't show up in the Problems panel
Check:
- ✅ The file matches your configured
includePatterns
- ✅ The extension is enabled:
"snuts-js.enabled": true
- ✅ VS Code has indexed the file (wait a moment after opening)
No issues detected in my test files
This could mean:
- Your tests follow good practices! 🎉
- The file doesn't match any configured patterns (edit
snuts-js.includePatterns)
- The extension is disabled (check settings)
How to Report Issues
Found a bug or have a feature request? Please open an issue on the GitHub repository.
About @snutsjs/core
SNUTS.js uses @snutsjs/core for its detection engine. New detectors added to that package are automatically supported—no extension updates needed!
License
This extension is distributed under GPL-3.0 to remain compatible with @snutsjs/core.
Known Limitations
- No automatic fixes — Currently diagnostics only (fixes coming in future releases)
- File-level analysis — Analysis runs per file, not across test suites