title: Jest Array Assertion: ANY in expected are in actual
body: <p>Say I am using Jest to make an assertion on two arrays of the same type, call them <code>actual</code> and <code>expected</code>. Using the <code>arrayContaining</code> matcher, it is simple to test that ALL elements in <code>expected</code> are in <code>actual</code>:</p>
  <pre class="lang-js prettyprint-override"><code>test('ALL elements in expected are in actual', () =&gt; {
      const actual = [1, 2, 3, 4, 5, 6]
      const willPass = [2, 3, 4]
      const willFail = [5, 6, 7]
  
      expect(actual).toEqual(expect.arrayContaining(willPass))
      expect(actual).toEqual(expect.arrayContaining(willFail))
  });
  </code></pre>
  <p>And the inverse, that ANY in <code>expected</code> is NOT in <code>actual</code>, just needs the <code>not</code> modifier.</p>
  <p>However, I can't seem to find the right way to use this matcher for the scenario &quot;ANY in expected are in actual&quot;. Of course, I could use a raw JS evaluation to create an assertion:</p>
  <pre class="lang-js prettyprint-override"><code>expect(willPass.some(v =&gt; actual.includes(v))).toBe(true)
  </code></pre>
  <p>But doing this means that the resultant failure message is very generic (expected true received false, not very helpful).</p>
  <p>Is there a way to test that ANY element in <code>expected</code> is in <code>actual</code> using Jest's matchers?</p>