Where Are the Unit Tests Located in the Archify Repository? A Complete Guide
All unit tests in the Archify repository are located in the archify/test/ directory, with files following the *.test.mjs naming convention and using Node's built-in node:test framework.
The Archify project, maintained by tt-a1i/archify on GitHub, organizes its testing infrastructure in a single, predictable location. Understanding where unit tests live and how to run them is essential for contributors and developers extending the codebase. This guide covers the exact directory structure, naming patterns, and execution methods based on the current source code.
Unit Test Directory Structure
Every unit test in Archify resides under archify/test/. This centralized approach eliminates hunting through subdirectories and keeps the test suite discoverable.
Typical test files include:
archify/test/visual-check.test.mjs— verifies visual-check behaviorarchify/test/v1-compatibility.test.mjs— validates backward compatibility with v1 APIarchify/test/toolbar-polish.test.mjs— tests toolbar UI logic
All files use the .test.mjs extension, indicating ECMAScript modules with Node's native test runner.
Test Framework: Node's Built-in Runner
Archify uses Node's native node:test module rather than third-party frameworks like Jest or Mocha. This choice reduces dependencies and leverages Node's evolving standard library.
A helper script at scripts/run-tests.mjs provides a convenience wrapper around the test runner. The script simply invokes Node's test runner on the archify/test/ directory, executing all *.test.mjs files found there.
How to Run the Unit Tests
Run the Full Test Suite
From the repository root:
npm install
node scripts/run-tests.mjs
Run a Single Test File
For targeted debugging or faster iteration:
node --test archify/test/visual-check.test.mjs
This pattern mirrors standard Node behavior and integrates cleanly with CI pipelines.
Test File Structure Example
Test files import from node:test and use assertion libraries like @esm-bundle/chai. The skeleton follows this pattern:
import { test, describe, after } from 'node:test';
import { expect } from '@esm-bundle/chai';
test('visual-check returns 1 and preserves evidence when any viewport overflows', async () => {
// test implementation
expect(result).to.equal(1);
});
Key characteristics of Archify unit tests:
- ECMAScript modules (
.mjsextension) - Native Node test runner (
node:testimports) - Chai assertions via
@esm-bundle/chaifor readable expectations
Key Files and Their Purposes
Understanding the layout of where unit tests are located in the Archify repository also means knowing these supporting files:
| Path | Purpose |
|---|---|
archify/test/ |
Root directory containing all *.test.mjs files |
archify/test/visual-check.test.mjs |
Visual regression and overflow detection tests |
archify/test/v1-compatibility.test.mjs |
API backward compatibility validation |
archify/test/toolbar-polish.test.mjs |
Toolbar component UI logic tests |
scripts/run-tests.mjs |
Convenience script for executing the full suite |
Summary
- Unit tests are located in
archify/test/— a single, centralized directory - Naming convention: all files use
*.test.mjsfor ESM compatibility - Test framework: Node's native
node:testmodule with Chai assertions - Execution:
scripts/run-tests.mjsfor full suite,node --testfor individual files
Frequently Asked Questions
Can I use Jest or Mocha instead of Node's native test runner?
Archify's unit tests are tightly coupled to node:test as implemented in tt-a1i/archify. While technically possible to reconfigure, the existing *.test.mjs files import directly from node:test, making migration non-trivial. For consistency, use the built-in runner as the source code demonstrates.
Why does Archify use .mjs extensions instead of .js with "type": "module"?
The .mjs extension explicitly marks files as ECMAScript modules, ensuring consistent behavior across Node versions and tooling. This is visible throughout archify/test/ where every unit test file uses the .test.mjs suffix, removing ambiguity about module type.
How do I add a new unit test to the Archify repository?
Create a new file in archify/test/ following the *.test.mjs pattern. Import test and describe from node:test, write your test cases, and run node --test archify/test/your-new-file.test.mjs to verify. The file will automatically be picked up by scripts/run-tests.mjs on the next full suite execution.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →