Skip to main content
Version: v2.x.x

πŸ—„οΈ List Files

Returns all files in a directory (independent of their depth) or the file itself.

History
VersionChanges
v2.5.0
CLI: deprecate --list-files in order to --listFiles.
v2.4.0
Support for CLI usage.

CLI​

Displays all the files returned in the terminal, without running the tests.

npx poku --listFiles
npx poku ./test --listFiles
npx poku ./packages/**/test --listFiles
npx poku ./test/unit ./test/e2e --listFiles
  • You can use the --filter and --exclude flags and include multiple paths.
note

The files returned by --listFiles don't reflect the paths displayed by --debug:

  • --debug: the paths to be searched for.
  • --listFiles: the paths found.
tip

If you pass flags apart from --filter and --exclude, they will be ignored.

API​

listFiles(targetDir: string, configs?: ListFilesConfigs)

import { listFiles } from 'poku';

await listFiles('some-dir');
  • You can use the filter and exclude options, as well as they are for poku method.
info

To compile tests using listFiles with TypeScript, you may will need to install @types/node:

npm i -D @types/node