pub struct TestSideMatcher { /* private fields */ }Expand description
Decides which files of a graph without production mode are test-side.
A file is test-side when an entry point reaches it and one of these is true:
- a production exclude pattern or a
production.ignoreglob matches its root-relative path (test, story, fixture, bench and config files); - no runtime entry point reaches it, as for a test helper below
src/that only tests import, or a file that only a support entry seeds.
An unreachable file is never test-side: an unused test helper is not an importer.
Self::with_support_reach narrows the second rule to the files that
no support entry reaches either. Production mode analyzes most files that
a support entry reaches, for example a source file that a bundler config
names, so the test-only-export rule treats them as production code.
Implementations§
Source§impl TestSideMatcher
impl TestSideMatcher
Sourcepub fn new(config: &ResolvedConfig) -> Self
pub fn new(config: &ResolvedConfig) -> Self
Build the matcher for the project of config, in any mode. A file
that only a support entry reaches is test-side.
The test importers of a production finding use this rule. The export of such a finding is unused in production mode, so a file that production mode analyzes cannot import it.
Sourcepub fn with_support_reach(config: &ResolvedConfig, graph: &ModuleGraph) -> Self
pub fn with_support_reach(config: &ResolvedConfig, graph: &ModuleGraph) -> Self
Build the matcher for graph, where a file that a support entry
reaches is not test-side unless a production exclude glob matches it.
Sourcepub fn is_test_side(&self, node: &ModuleNode) -> bool
pub fn is_test_side(&self, node: &ModuleNode) -> bool
Whether node is a test-side file. See TestSideMatcher.
Auto Trait Implementations§
impl Forget for TestSideMatcher
impl Freeze for TestSideMatcher
impl Move for TestSideMatcher
impl RefUnwindSafe for TestSideMatcher
impl Send for TestSideMatcher
impl Sync for TestSideMatcher
impl Unpin for TestSideMatcher
impl UnsafeUnpin for TestSideMatcher
impl UnwindSafe for TestSideMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more