filter
Filter by path using Regex to match only the files that should be performed.
By default, Poku searches for .test. and .spec. files, but you can customize it using the filter option.
CLIβ
# Default
npx poku --filter='.test.|.spec.' ./test
# Testing only a specific file
npx poku --filter='some-file' ./test
# Testing only specific files
npx poku --filter='some-file|other-file' ./test
# Testing only paths that contains "unit"
npx poku --filter='unit' ./test
# Testing only paths that contains "unit" by using Poku as a NPM script
npm run tests -- --filter='unit'
Environment Variableβ
By using FILTER from Environment Variable, it will overwrite the filter option.
# Testing only a specific file
FILTER='some-file' npx poku ./test
# Testing only specific files
FILTER='some-file|other-file' npx poku ./test
# Testing only paths that contains "unit"
FILTER='unit' npx poku ./test
# Testing only paths that contains "unit" by using Poku as a NPM script
FILTER='unit' npm run tests
Config Fileβ
Matching .test. files:
- poku.config.js
- .pokurc.jsonc
import { defineConfig } from 'poku';
export default defineConfig({
filter: /\.test\./,
});
{
"$schema": "https://poku.io/schemas/configs.json",
"filter": ".test."
}
Matching all js, ts, mjs and mts files:
- poku.config.js
- .pokurc.jsonc
import { defineConfig } from 'poku';
export default defineConfig({
filter: /\.(m)?(j|t)s$/,
});
{
"$schema": "https://poku.io/schemas/configs.json",
"filter": ".(m)?(j|t)s$"
}