chore: add options for matching and ignoring test files in e2e and p-test commands (#3811)

This commit is contained in:
Zeke Zhang 2024-03-25 12:29:44 +08:00 committed by GitHub
parent 5e22103e33
commit f2828cd8b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -243,6 +243,12 @@ module.exports = (cli) => {
.option('--stop-on-error')
.option('--build')
.option('--concurrency [concurrency]', '', os.cpus().length)
.option(
'--match [match]',
'Only the files matching one of these patterns are executed as test files. Matching is performed against the absolute file path. Strings are treated as glob patterns.',
'packages/**/__e2e__/**/*.test.ts',
)
.option('--ignore [ignore]', 'Skip tests that match the pattern. Strings are treated as glob patterns.', undefined)
.action(async (options) => {
process.env.__E2E__ = true;
if (options.build) {

View File

@ -60,7 +60,8 @@ exports.pTest = async (options) => {
fs.mkdirSync(dir, { recursive: true });
}
const files = glob.sync('packages/**/__e2e__/**/*.test.ts', {
const files = glob.sync(options.match, {
ignore: options.ignore,
root: process.cwd(),
});