* @param {string} directory
(directory)
| 273 | * @param {string} directory |
| 274 | */ |
| 275 | function getFileNamesAndRemoveOutput(directory) { |
| 276 | try { |
| 277 | return readdirSync(directory).filter(fileName => { |
| 278 | if (fileName === '_actual') { |
| 279 | rmSync(path.join(directory, '_actual'), { |
| 280 | force: true, |
| 281 | recursive: true |
| 282 | }); |
| 283 | return false; |
| 284 | } |
| 285 | if (fileName.startsWith('_actual.')) { |
| 286 | unlinkSync(path.join(directory, fileName)); |
| 287 | return false; |
| 288 | } |
| 289 | return true; |
| 290 | }); |
| 291 | } catch (error) { |
| 292 | if (error.code === 'ENOTDIR') { |
| 293 | throw new Error( |
| 294 | `${directory} is not located next to a "_config.js" file but is not a directory or old test output either. Please inspect and consider removing the file.`, |
| 295 | { cause: error } |
| 296 | ); |
| 297 | } |
| 298 | throw error; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput; |
| 303 |
no outgoing calls
no test coverage detected
searching dependent graphs…