Skip to content

TestSandbox random dir generation #1398

@virkt25

Description

@virkt25

Description / Steps to reproduce / Feature proposal

Current TestSandbox uses the same folder the user provides for tests. If a file put in the sandbox is required, it gets cached by it. A workaround for clearing the cache was introduced in #1391 but as per the comments, #1391 (comment), decaching has it's own challenges.

Current Behavior

Expected Behavior

TestSandbox should create a random folder in the given path (can be considered a basepath). When the sandbox is reset, instead of decaching -- we delete the old random folder and create a new one for the user. Similar behaviour as used in loopback-boot, see comment #1391 (comment)

Acceptance Criteria

  • Given a path for a TestSandbox (like present) - the instance should create a random folder inside that for the test
  • When the TestSandbox instance is reset, the randomly generated folder should be deleted. A new random folder should be generated -- prevent issues with caching and parallel tests.
  • Provide convenience methods on TestSandbox instance such as sandbox.resolve(), sandbox.existsFile(), sandbox.existsDir(), etc. -- to make working with sandbox easier as we now have random folders being generated -- this should be an abstraction from the user of TestSandbox.
  • Tests
  • Docs (TestSandbox is currently lacking documentation).

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions