Skip to content

Commit

Permalink
fix: sort list of the file paths emitted by --list-files (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas authored Aug 6, 2024
1 parent f94e657 commit 2b0528a
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,33 @@ import { getConfigs } from '../parsers/options.js';
if (hasArg('list-files')) {
const { listFiles } = require('../modules/helpers/list-files.js');

let total = 0;
const files: string[] = [];

Write.hr();

for (const dir of dirs) {
const files: string[] = await listFiles(dir, {
filter:
typeof filter === 'string'
? new RegExp(escapeRegExp(filter))
: filter,
exclude:
typeof exclude === 'string'
? new RegExp(escapeRegExp(exclude))
: exclude,
});

total += files.length;

Write.log(files.map((file) => `${format('-').dim()} ${file}`).join('\n'));
files.push(
...(await listFiles(dir, {
filter:
typeof filter === 'string'
? new RegExp(escapeRegExp(filter))
: filter,
exclude:
typeof exclude === 'string'
? new RegExp(escapeRegExp(exclude))
: exclude,
}))
);
}

Write.log(
files
.sort()
.map((file) => `${format('-').dim()} ${file}`)
.join('\n')
);
Write.hr();
Write.log(`Total test files: ${format(String(total)).bold()}`);
Write.log(`Total test files: ${format(String(files.length)).bold()}`);
Write.hr();

return;
Expand Down

0 comments on commit 2b0528a

Please sign in to comment.