or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

Test Isolation Manager

Build a test utility that manages filesystem state isolation between test cases using an in-memory filesystem.

Requirements

Create a test isolation manager that:

  1. Provides methods to set up filesystem state before tests
  2. Automatically cleans up filesystem state after tests
  3. Ensures each test starts with a clean filesystem
  4. Supports running multiple test suites with proper isolation

The manager should expose:

  • A method to initialize the filesystem with test data
  • A method to clean up after tests complete
  • A method to get the current filesystem instance for test assertions

Test Cases

Basic Cleanup

  • After writing files and creating directories, cleanup should restore the filesystem to its initial empty state @test

Multiple Test Isolation

  • Running multiple test suites sequentially should not have any state leakage between them @test

File Descriptor Cleanup

  • Open file descriptors should be properly closed during cleanup @test

Implementation

@generates

API

/**
 * Creates a test isolation manager for filesystem testing.
 *
 * @returns {Object} Manager with setup, cleanup, and getFs methods
 */
function createTestManager() {
  // IMPLEMENTATION HERE
}

module.exports = { createTestManager };

Dependencies { .dependencies }

metro-memory-fs { .dependency }

Provides in-memory filesystem implementation for testing.

@satisfied-by