diff --git a/psf-memo-db/acceptance/acceptance.js b/psf-memo-db/acceptance/acceptance.js index 2d28f96..cf4b13d 100644 --- a/psf-memo-db/acceptance/acceptance.js +++ b/psf-memo-db/acceptance/acceptance.js @@ -33,7 +33,19 @@ function ensureAps () { 'https://github.com/unclebob/Acceptance-Pipeline-Specification.git', apsDir]) } +// Each scenario opens an isolated LevelDB directory under tmp/acceptance. +// Remove leftovers from earlier runs (including pre-fix runs that leaked them) +// so the directory cannot grow without bound. +function cleanStaleWorlds () { + try { + fs.rmSync(path.join(root, 'tmp', 'acceptance'), { recursive: true, force: true }) + } catch (err) { + // ignore cleanup errors + } +} + function main () { + cleanStaleWorlds() ensureAps() const features = fs diff --git a/psf-memo-db/acceptance/lib/handlers.js b/psf-memo-db/acceptance/lib/handlers.js index 5fcb71c..0030719 100644 --- a/psf-memo-db/acceptance/lib/handlers.js +++ b/psf-memo-db/acceptance/lib/handlers.js @@ -152,6 +152,13 @@ async function createWorld () { } catch (err) { // ignore close errors } + // Each scenario opens an isolated LevelDB directory. Remove it here so + // tmp/acceptance cannot grow without bound across runs. + try { + fs.rmSync(levelDir, { recursive: true, force: true }) + } catch (err) { + // ignore cleanup errors + } } } }