Uri.base ignores IOOverrides which breaks paths package #39796
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-io
type-enhancement
A request for a change that isn't a bug
I'm using the 'path' package to write a library dcli.
https://pub.dev/packages/dcli
The library does path manipulation using the 'path' package as well as allowing a library user to modify the file system.
I'm trying to write unit tests for the dcli package.
To avoid possible damage of the file system I'm using a IOOverrides zone and providing a MemoryFileSystem.
Unit tests also run in parallel and as dcli has a shared cache directory I need the ability to isolate each unit test and as such each Unit test needs its own MemoryFileSystem.
The problem is that the path package calls Uri.base to determine the current working directory (cwd).
If you call Directory.current the IOOverrides zone behaves as expected by returning the IOOverrides MemoryFileSystem's cwd.
If you call Uri.base it utilizes _Directory._current which bypasses the IOOverride mechanism. The result is that Uri.base incorrectly returns the cwd of the root zone.
Unit test demonstrating the problem.
Edit: updated to reflect that the package dshell has been renamed to dcli.
The text was updated successfully, but these errors were encountered: