logsPropRequiredError function

_PropTypeLogMatcher logsPropRequiredError(
  1. String propName, [
  2. String message = ''
])

A matcher to verify that a PropError.required is returned within UiComponent2.propTypes with the provided propName and optional message.

This matcher only works for PropError.requireds that are returned within UiComponent2.propTypes. If you are testing a PropError.required that is thrown anywhere else within a component, use throwsPropError_Required.

This matcher is built on top of logsPropTypeWarning and has the same behavior of running the provided callback, swallowing errors that occur, and looking for the expected PropError.required in the resulting logs.

NOTE: Will only produce failures when tests are run using the dartdevc compiler since the react package "tree shakes" propTypes from dart2js compiled output.

Implementation

_PropTypeLogMatcher logsPropRequiredError(String propName, [String message = '']) {
  return logsPropTypeWarning('RequiredPropError: Prop $propName is required. $message'.trim());
}