MCPcopy Index your code
hub / github.com/rollup/rollup / getFileNamesAndRemoveOutput

Function getFileNamesAndRemoveOutput

test/testHelpers.js:275–300  ·  view source on GitHub ↗

* @param {string} directory

(directory)

Source from the content-addressed store, hash-verified

273 * @param {string} directory
274 */
275function 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
302exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput;
303

Callers 1

runTestsInDirectoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…