Skip to content

Support additional glob pattern formats such as **/*{test,spec}.ts in include/exclude specifiers #47001

@aladdin-add

Description

@aladdin-add

Suggestion

🔍 Search Terms

✅ Viability Checklist

My suggestion meets these guidelines:

  • [ x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [ x] This wouldn't change the runtime behavior of existing JavaScript code
  • [ x] This could be implemented without emitting different JS based on the types of the expressions
  • [ x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • [ x] This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

a tsconfig.json example:

{
  "extends": "@tsconfig/node16/tsconfig.json",
  "include": ["lib/**/*.ts"],
  "exclude": ["**/*.{test,spec}.ts"]
}
  • "exclude": ["**/*.test.ts"] ✅supported
  • "exclude": ["**/*.{test,spec}.ts"] ❌not supported. (ts v4.5)

I'd propose support patterns like this, as it's very widely used in js community, e.g. babel/jest/eslint/....

💻 Use Cases

workaround: "exclude": ["**/*.test.ts", "**/*.spec.ts"]. but it would have a better readability to write to one pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions