()
| 223 | } |
| 224 | |
| 225 | const clearOldTestFiles = () => { |
| 226 | try { |
| 227 | const folderPath = getTestPath().replace('test-image-snapshots.js', ''); |
| 228 | const oldTestFiles = readdirSync(folderPath) |
| 229 | .filter(name => /test-image-snapshots(-\d+x\d+)\.js$/.test(name)); |
| 230 | for (const name of oldTestFiles) { |
| 231 | unlinkSync(`${folderPath}${name}`); |
| 232 | } |
| 233 | } catch (err) { |
| 234 | throw new Error(`Couldn't delete previous test files.`); |
| 235 | } |
| 236 | }; |
| 237 | |
| 238 | const getTestPath = (suffix = '') => |
| 239 | TEST_PATH_BASE.replace('test-image-snapshots.js', `test-image-snapshots${suffix}.js`); |
no test coverage detected