Skip to content

Suggestion: Add compiler flag to ignore private/protected member access control for unit tests #12111

@bcherny

Description

@bcherny

Most of my unit tests test an interface's public members, but sometimes I want to test a private or protected method.

To do this today, I have to make the method public and add a JSDoc annotation ("Do not use!!!").

It would be nice to have a compiler flag (--suppressControlledMemberAccessErrors?) that I can use when compiling my code for unit testing, so I don't have to do gymnastics to test access controlled members.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Out of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions