In 2026, Atlas empowers Fastify developers to add real unit tests to modules lacking coverage, by intelligently replicating existing repository conventions and leveraging the `node:test (fastify.inject)` runner. Atlas reads your Fastify application's structure, identifies exported symbols, and then drafts, runs, and refines test suites, ensuring every public function is thoroughly validated.
How Atlas identifies untested Fastify code for new unit tests
Atlas streamlines the process of identifying untested Fastify code by first reading the target module and then using its `lsp` tool to enumerate exported symbols. This ensures that in 2026, no public function or route decorator within your Fastify plugin encapsulation context is overlooked when generating new `node:test` specifications.
To begin adding unit tests to a Fastify module that currently lacks them, Atlas first uses its `read` tool to ingest the module's source code. Following this, the `lsp` tool's `documentSymbol` operation is invoked to meticulously list all exported symbols. This comprehensive enumeration is crucial for Fastify applications, where plugin encapsulation contexts, decorators, and route handlers define the public API. By understanding these declarations, Atlas can ensure that every public function, route, or utility within your `fastify.js` or `app.ts` file is considered for testing. This initial step is vital for creating a complete test plan, preventing gaps in coverage for your Fastify services.
Generating Fastify `node:test` specs with existing conventions
Atlas generates new `node:test` specifications for Fastify modules by first analyzing your repository's existing test conventions, ensuring consistency across your codebase. This process involves using the `grep` tool to find an existing test file, allowing Atlas to replicate the framework, import style, and naming conventions for your new `app.inject()` cases in 2026.
After identifying the symbols to test, Atlas focuses on maintaining consistency with your existing Fastify project's testing practices. It employs the `grep` tool to locate an existing test file within your repository. This step is critical for understanding the established framework (e.g., `node:test`), import styles, and naming conventions already in use. For Fastify applications, this often means observing how `fastify.inject()` is used for route testing, how plugins are registered in test setups, and the structure of assertion libraries. Once these conventions are understood, Atlas uses its `write` tool to draft the new spec file. Before any changes are committed to disk, Atlas presents a unified diff for your approval, ensuring that the generated `node:test` code aligns perfectly with your Fastify project's standards and uses `app.inject()` appropriately for HTTP request simulation.
Running and iterating on Fastify tests with Atlas
Atlas executes the newly generated Fastify unit tests using the `bash` tool, directly invoking `node --test` to run your `node:test (fastify.inject)` suite. This immediate execution is paramount, as a test that is never run provides zero value. If the output exceeds 2000 lines or 50 KB, Atlas truncates it in the terminal but saves the full log to a file for detailed review.
The true value of a test lies in its execution. Atlas uses the `bash` tool to run the newly written `node:test` suite for your Fastify module. This involves executing the actual command, typically `node --test <path/to/test/file.test.js>`, which leverages `fastify.inject()` for simulating HTTP requests against your Fastify routes. Atlas captures the output of these test runs, allowing you to immediately see failures and successes. If the test output is extensive, exceeding 2000 lines or 50 KB, Atlas intelligently truncates the terminal display to maintain readability while saving the complete log to a file for comprehensive analysis. This iterative process continues with the `edit` tool, where Atlas refines the test code based on failures. For larger Fastify modules, Atlas can maintain a `todowrite` list to track progress, ensuring all identified symbols eventually receive passing tests. After successful test runs, Atlas can also run `prettier` on the touched plugins to maintain code formatting consistency.
Ensuring code quality and safety in Fastify test generation
Atlas prioritizes safety and quality throughout the Fastify test generation process, ensuring every tool call is permission-gated against allow, ask, and deny rules. Before any changes are written to your `fastify.js` or `app.ts` files, Atlas computes and surfaces a unified diff for approval, providing complete transparency and control over the 2026 development workflow.
Safety and developer control are core tenets of Atlas. Every action Atlas takes, from reading your Fastify module to writing new `node:test` files, is permission-gated. This means that before any Atlas tool call runs, it checks against predefined allow, ask, and deny rules, giving you granular control over its operations. When Atlas drafts a plan, it does so in a read-only plan agent and explicitly asks for permission before switching to a build agent to make changes. Crucially, for every file edit, Atlas computes a unified diff and presents it for your explicit approval. This ensures that you, the Fastify developer, have the final say on all modifications, whether it's adding `app.inject()` calls or adjusting JSON schemas. Atlas also snapshots file changes as git patches, allowing edits to be easily diffed and rolled back if needed, providing a robust safety net for your Fastify codebase.
Step by step
- 01Run `atlas read <path/to/fastify/module.js>` to ingest the target Fastify module's source code.
- 02Execute `atlas lsp documentSymbol <path/to/fastify/module.js>` to enumerate all exported symbols, ensuring no Fastify plugin or route is missed.
- 03Use `atlas grep 'test/'` or `atlas grep 'fastify.inject'` to find an existing `node:test` file and understand the repository's testing conventions for Fastify.
- 04Draft the new `node:test` spec file with `atlas write <path/to/new/test.test.js>`, reviewing the unified diff for `app.inject()` cases and Fastify-specific assertions.
- 05Run the Fastify test suite using `atlas bash 'node --test <path/to/new/test.test.js>'` and analyze the output for failures. If output exceeds 2000 lines, check the saved log file.
- 06Iterate on the test code with `atlas edit <path/to/new/test.test.js>` until the `node:test` suite is green, using `atlas todowrite` for large Fastify modules.
- 07Approve the final diffs and let Atlas run `prettier <path/to/new/test.test.js>` to format the new Fastify test file according to project standards.
Frequently asked questions
- How does Atlas ensure new Fastify tests match my existing codebase style?
- Atlas uses its `grep` tool to scan your repository for existing `node:test` files. It analyzes the framework, import styles, and naming conventions, including how `fastify.inject()` is used. This allows Atlas to generate new test files that direct integrate with your Fastify project's established practices, ensuring consistency.
- Can Atlas test Fastify routes that use JSON schema serialization?
- Yes, Atlas is designed to work with Fastify's features. It can read your plugin encapsulation contexts and the JSON schemas attached to each route. When generating tests, Atlas can be asked to add response schemas to `app.inject()` cases, ensuring Fastify can fast-serialize payloads and that your tests validate the schema-driven responses.
- What Fastify test runner does Atlas use?
- Atlas specifically leverages the `node:test` runner, which is the built-in Node.js test module. For Fastify applications, this means Atlas generates and executes tests that utilize `fastify.inject()` to simulate HTTP requests and responses, providing robust unit testing for your routes and plugins.
- How does Atlas handle large test outputs from Fastify suites?
- When running Fastify test suites with the `bash` tool, Atlas monitors the output size. If the output exceeds 2000 lines or 50 KB, Atlas truncates the display in your terminal for readability. However, the complete log is always saved to a file, which you can then review in detail to diagnose any Fastify test failures.
- Is it safe to let Atlas modify my Fastify application code?
- Yes, Atlas is built with safety in mind. All Atlas tool calls are permission-gated, requiring your explicit approval. Before any changes are written to your Fastify files, Atlas presents a unified diff for your review. You must approve this diff before any modifications, such as new `node:test` files or `prettier` formatting, are applied to your codebase.
- Can Atlas help me add response schemas to my Fastify routes?
- Absolutely. Atlas can read your Fastify application's plugin encapsulation contexts and existing JSON schemas. You can ask Atlas to add a response schema to a Fastify route, which enables Fastify to fast-serialize the payload instead of falling back to `JSON.stringify`, improving performance and ensuring schema compliance.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Write Unit Tests for Untested Code with Atlas in 2026
How to write unit tests for untested code with Atlas in 2026: the lsp tool enumerates exported symbols, grep copies repo conventions, and bash actually runs the suite.
Atlas for Fastify in 2026
Atlas is a terminal-native AI coding agent for Fastify in 2026. It reads plugin encapsulation and JSON schemas, then runs node --test behind a permission prompt.
Review a Pull Request in Fastify with Atlas in 2026
In 2026, Fastify developers use Atlas to review pull requests, catching subtle bugs beyond line-by-line diffs. Leverage `node:test (fastify.inject)`, `npm`, and `prettier` for comprehensive code quality.
Run the Test Suite and Triage Failures in Fastify with Atlas in 2026
Fastify developers in 2026 use Atlas to efficiently run their `node:test` suites, capture full output, and triage failures into a prioritized list of distinct root causes. Streamline your debugging workflow.
Trace a runtime bug from a stack trace in Fastify with Atlas in 2026
Fastify developers in 2026 use Atlas to trace runtime bugs from production stack traces. Pinpoint the exact line, understand context, and apply fixes with `npm` and `node:test`.
Add a Regression Test for a Fastify Bug Fix with Atlas in 2026
Lock in Fastify bug fixes with Atlas in 2026. Learn to add regression tests using node:test (fastify.inject) and npm, ensuring your Fastify application remains robust. Atlas automates the red-green testing cycle
Run Atlas Headless in CI for Fastify Applications in 2026
Automate Fastify application development in CI pipelines with Atlas. Learn to run Atlas headless, integrate with `npm` and `node:test (fastify.inject)`, and get machine-readable output for your Fastify projects.
Debug a single failing test in Fastify with Atlas in 2026
In 2026, Fastify developers use Atlas to debug single failing `node:test` cases. Learn how Atlas leverages `fastify.inject()` and `npm` to pinpoint and fix code issues efficiently, ensuring your Fastify application