-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test suite failed to run #201
Comments
I need to do more research on this. We're using async/await in the library, which will cause issues if you're Jest is not using the correct polyfills. I tend to avoid shipping polyfills, since it's the developer who determines which platforms the code needs to execute on. I can pacakage all the polyfills with the library, but it will add an additional 100kb to the build, and most of it will be unnecessary for the majority of clients. Your best bet in the short term is to modify your Jest or Babel config to inject the Also see this issue for various resolutions: But again, I need to do more research. It might make the most sense to just include this one polyfill. The library was recently migrated to Babel, so we have the ability to instruct it how to properly transpile await/async. I'm happy to accept a PR for this too, as I'll be out of the country for the next few weeks. |
@AndrewCraswell My google-fu was weak on this one. Kept running into problems with Babel and I was unable to figure out the issue other than it being related to async/await. I'll have to figure out how to do this. I don't even have a babel config (I just use CRA) so I'll have to figure out how that works. |
I've hit this with a vanilla CRA and the solution was to add |
Can't you just list For what it's worth, this is often what I do on other projects, because you'll find there are many other projects that don't ship with the regenerator runtime. |
Yeah, I understand it's not actually this project that is broken. We should probably be discussing this in a CRA issue instead. I don't think any of the available overrides support injection? |
I think this is the one you need, which isn't described in the CRA docs as far as I can tell, but I thought it could be used even without ejecting: |
Hmmm other option is to use a setupTests file: |
Yep, that's a much nicer solution than adding the import to each test that's affected. I wasn't aware of that, thanks! |
So, what is the solution? how should look like setupTests.js file? |
Just add |
Library versions
react-aad-msal
: ^2.3.2msal
: ^1.2.1Describe the bug
When I run
npm run test
I get an error:Expected behavior
When I run tests, I don't expect an error. My tests should just run successfully. I should note that failing tests are testing components which import the authProvider file. (I add some additional functionality in there to complete partially applied axios requests with bearer tokens from the
acquireTokenSilent
).The text was updated successfully, but these errors were encountered: