@activefs/testing
v0.1.0
Published
ActiveFS memory trees, fixtures, and conformance helpers for tree implementations.
Maintainers
Readme
@activefs/testing
Memory trees, generated trees, fixtures, and conformance helpers for ActiveFS tree implementations.
Use this package in tests, examples, package smoke checks, and adapter development.
Install
npm install -D @activefs/testing vitestRequires Node.js 20 or newer. vitest is a peer dependency for conformance
helpers.
Small Example
import { createActiveFS } from "@activefs/core";
import { createMemoryTree } from "@activefs/testing";
const tree = createMemoryTree({
"/hello.md": "# Hello\n",
"/notes/todo.txt": "ship it\n"
});
const activefs = createActiveFS().mount("/", tree);
const file = await activefs.read({}, "/hello.md");
console.log(file.content);Conformance
import { runActiveFSTreeConformance } from "@activefs/testing/conformance";Use the conformance subpath when validating a custom ActiveFSTree
implementation against the shared behavior expected by ActiveFS adapters.
Docs
- Testing: https://github.com/ankitparasher/activefs/blob/main/docs/contributing/testing.md
- Core API: https://github.com/ankitparasher/activefs/blob/main/docs/reference/core-api.md
- Examples: https://github.com/ankitparasher/activefs/blob/main/docs/examples/README.md
