Closed passsy closed 2 years ago
Thanks for the patch.
In the latest release I've actually removed this method. I've moved to using a new method withEnvironment which utilises a new package I've released Scope. withEnvironment allows us to set a scoped environment change which doesn't affect code outside of the scope.
withTestScope((outerTempDir) {
withEnvironment(() {
/// create a pub-cache using the test scope's HOME
Scope()
..value(PubCache.scopeKey, PubCache.forScope())
..run(() {
if (Settings().isWindows) {
expect(
PubCache().pathToBin,
equals(
join(outerTempDir, 'test_cache', '.pub_cache', 'bin')));
} else {
expect(
PubCache().pathToBin,
equals(join(outerTempDir, 'test_cache', '.pub_cache', 'bin')),
);
}
});
}, environment: {
'PUB_CACHE': join(outerTempDir, 'test_cache', '.pub_cache')
});
});
That's even better because it doesn't share state between tests 👍
Allows