title: How to get Yup to perform more than one custom validation?
body: <p>I'm working on a ReactJS project.  I'm learning to use <code>Yup</code> for Validation with <code>FormIk</code> .  The following code works fine:</p>
  <pre><code>const ValidationSchema = Yup.object().shape({
    paymentCardName: Yup.string().required(s.validation.paymentCardName.required),
    paymentCardNumber: Yup.string()
    /*
      .test(
        &quot;test-num&quot;,
        &quot;Requires 16 digits&quot;,
        (value) =&gt; !isEmpty(value) &amp;&amp; value.replace(/\s/g, &quot;&quot;).length === 16
      )
    */
      .test(
        &quot;test-ctype&quot;,
        &quot;We do not accept this card type&quot;,
        (value) =&gt; getCardType(value).length &gt; 0
      )
      .required(),
  </code></pre>
  <p>But the moment I uncomment the <code>test-num</code> the developer tools complain about an uncaught promise:</p>
  <p><a href="https://i.stack.imgur.com/Xwh6b.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Xwh6b.png" alt="enter image description here" /></a></p>
  <p>How do I get Yup to give me a different error string based on the validation failure that I detect?</p>