(dir, predicate)
| 164 | const removed = []; |
| 165 | |
| 166 | const scan = async (dir, predicate) => { |
| 167 | if (!await fsModule.pathExists(dir)) return; |
| 168 | |
| 169 | for (const name of await fsModule.readdir(dir)) { |
| 170 | if (predicate(name)) { |
| 171 | const target = path.join(dir, name); |
| 172 | removed.push(target); |
| 173 | log(` 🗑️ ${apply ? 'Removing' : '[dry-run] would remove'} ${target}`); |
| 174 | if (apply) await fsModule.remove(target); |
| 175 | } |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | await scan(path.join(dataDir, 'sqlite'), name => name.startsWith('test-daemon-')); |
| 180 | await scan(dataDir, name => name.startsWith('wake-daemon-test-')); |
no test coverage detected