title: React jest and MSAL getting BrowserAuthError : crypto
body: <p>I'm trying to test a few components that are using MSAL for authentication.</p>
  <p>Thus far, I have a simple test, which test if my component can render, as follows:</p>
  <pre><code>// &lt;MsalInstanceSnippet&gt;
  const msalInstance = new PublicClientApplication({
    auth: {
      clientId: config.appId,
      redirectUri: config.redirectUri
    },
    cache: {
      cacheLocation: 'sessionStorage',
      storeAuthStateInCookie: true
    }
  });
  </code></pre>
  <p>When I run the test, I'm getting the following error:</p>
  <pre><code> BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto or msCrypto object not available.
  
        10 |
        11 | // &lt;MsalInstanceSnippet&gt;
      &gt; 12 | const msalInstance = new PublicClientApplication({
           |                      ^
        13 |   auth: {
        14 |     clientId: config.appId,
        15 |     redirectUri: config.redirectUri
  
        at BrowserAuthError.AuthError [as constructor] (node_modules/@azure/msal-common/dist/error/AuthError.js:27:24)
        at new BrowserAuthError (node_modules/@azure/msal-browser/src/error/BrowserAuthError.ts:152:9)
        at Function.Object.&lt;anonymous&gt;.BrowserAuthError.createCryptoNotAvailableError (node_modules/@azure/msal-browser/src/error/BrowserAuthError.ts:172:16)
        at new BrowserCrypto (node_modules/@azure/msal-browser/src/crypto/BrowserCrypto.ts:31:36)
        at new CryptoOps (node_modules/@azure/msal-browser/src/crypto/CryptoOps.ts:45:30)
        at PublicClientApplication.ClientApplication (node_modules/@azure/msal-browser/src/app/ClientApplication.ts:108:58)
        at new PublicClientApplication (node_modules/@azure/msal-browser/src/app/PublicClientApplication.ts:49:9)
        at Object.&lt;anonymous&gt; (src/App.test.tsx:12:22)
  </code></pre>
  <p>I'm unsure what the above means, but as far as I can understand, this error is occurring because the session is not authenticated.</p>
  <p>My question can therefore be divided into the following:</p>
  <p>What does this error mean?
  How can I solve this error? (Can we bypass MSAL by any chance for testing purposes?)</p>