logsPropValueError function

_PropTypeLogMatcher logsPropValueError(
  1. dynamic invalidValue,
  2. String propName, [
  3. String message = ''
])

A matcher to verify that a PropError.value is thrown with the provided invalidValue, propName, and optional message.

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

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.value 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 logsPropValueError(dynamic invalidValue, String propName, [String message = '']) {
  return logsPropTypeWarning('InvalidPropValueError: Prop $propName set to $invalidValue. '
      '$message'.trim());
}