-
Notifications
You must be signed in to change notification settings - Fork 316
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
Jest test fails on error thrown by package mapbox-gl
#1647
Comments
Same issue here.
|
Thanks @KydneyBeen ! I'm glad you found a workaround. We'll look at this. We do have a related fix for next week, that will help with tree shaking, so if you're not using our new Geo map, it should not affect your build. |
@ErikCH — it's affecting builds in the amplify console:
My
Thought I was going crazy all day but no, I'd just upgraded amplify packages. Sheesh. Sheesh. Gonna go take a break now. |
An update — adding For reference, I spent all day yesterday trying to figure out why Nowhere in my app uses a single thing about a map or anything, so why there's 700kb of a mapping library both breaking my builds and slowing down the app I'm trying to build to be competitive as a startup in 2022… well, Amplify is the only reason I'm not moving forward and have lost my valuable weekend time. @ErikCH — I get that y'all are moving super fast and that you have an update planned to fix tree shaking and likely this issue. But your team's got to button up your releases. Amplify is pitched as a time-saving toolkit which is why I selected it, secured $10,000 in AWS credits, and have kept banging my head against the wall trying to get it to work. However, I'm just one dude trying to code an app (which I promise I know how to do, but Amplify has made me feel like I should give up) so super basic stuff like this makes me look for other solutions entirely off AWS. One other note, while I'm here. The documentation y'all have is a big challenge: to read about Auth, I have to first know about and then read THREE different sections of your website:
Each section focuses on completely different aspects of the auth setup process, in complete isolation. I have been researching Amplify for weeks now. I have a good understanding of how it pieces together. But I'm not encouraged when I come across documentation scattered online I have never seen before, which is what happened yesterday going on this merry debugging journey. I would estimate I've spent 20 hours reading Amplify docs in the lead up to starting development. I did my homework. And then y'all shipped an update that broke dependencies and has wasted about 20 more of my hours now debugging it. All of this started because I tried to use Anyway. Thanks for listening. I appreciate what y'all are trying to do (ex-Salesforce TA here) and how hard the documentation portion of it is. If you have the ear of program leadership, show them this comment. Whatever your org is doing cost y'all my business. Love, The customer you're trying to attract, the single-developer startup founder |
I couldn't agree more with @mglikesbikes. |
@mglikesbikes I feel you! We have the same problem, we spend the whole day trying to understand what was breaking our app. Now we can't release anything. Supposed to be easy-to-use and since day 1 every time we want to make a change or customize 1 small thing it takes us ages and we can't find any clear documentation. |
We apologize you are having this issue. We are currently working on implementing a fix for this and will update here shortly! |
Hi @mglikesbikes , @raffpaquin @roxannelessard ! Thanks for the feedback. We are working on some additional checks of our releases to make sure that we catch things like this up front. We have just made a new release, Let me know if that fixes your issue. If you are using the map component in your app, and you're still having an issue with Jest, let me know, and we can investigate further. |
And @mglikesbikes ! I passed your concern on the documentation to our documentation team, to see if we can improve it for the future. It should NOT take you 20 hours in the Amplify docs to get up and running. We need to make looking up things easier. |
Glad to hear it! I should have locked in my package versions anyways. I suspect if someone were using the Ditto about the docs; it was tough to find all the information in all the different locations: https://ui.docs.amplify.aws/ And in the end I often just read the code. Documentation on how to test the Auth UI would be cool; I worked around it because of some crypto issue with the mock browsers. |
I agree regarding the documentation. |
I am able to successfully run my React app, however, I started receiving 12 warnings about maplibre-gl-js-amplify. I am not using mapping or geo in my app. I have installed "@aws-amplify/ui-react": "^2.15.3", and "aws-amplify": "^4.3.20", WARNING in ./node_modules/maplibre-gl-js-amplify/lib/esm/AmplifyMapLibreGeocoder.js |
@dave-moser we're currently working on releasing a fix for the source map warning on the maplibre-gl-js-amplify package - aws-amplify/maplibre-gl-js-amplify#147 We've already pushed the change and are looking to release early next week |
Just ran into this one as well. @thaddmt thanks! |
We will release a fix for source map warnings on 4/19. We appreciate your patience until then and apologize for this wait. |
@sameerdewan @dave-moser The warnings you were seeing should be fixed in the latest version of |
Just updated to to 2.15.4 and the issue is resolved. Thanks! |
In regards to the original issue with Jest not recognizing // jest.config.js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
...
}; Then create your // jest.setup.js
if (typeof window.URL.createObjectURL === 'undefined') {
window.URL.createObjectURL = jest.fn();
} This is based on a proposed workaround regarding this issue in the While this workaround will unblock issues with Jest, we recognize it isn't an ideal solution and we are actively working on ways to address this without relying upon a polyfill for this function being added in the underlying |
@funes79 @mglikesbikes @roxannelessard I believe the issue of not resolving the |
We've updated our troubleshooting documentation to provide a workaround to this issue in Jest and we will continue to find a long-term solution on our end to the polyfilling problem. |
In ui-react 3.4.1 maplibre-gl is still pulled in and the issue of window.URL.createObjectURL not being a function still exists. If either was fixed in 2.15.4 the issue has returned. |
@johndrewery The |
amplify-ui/packages/react/package.json
Line 71 in 27ea4f0
While testing a react functional component with jest, my tests failed to run due to the below error. I isolated the issue to the dependency @aws-amplify/ui-react bump from 2.10.0 to 2.15.0, and the stack trace shows the error is being thrown by this newly introduced package.
The error has a known workaround: https://stackoverflow.com/questions/52968969/jest-url-createobjecturl-is-not-a-function
There is also a package known to have the createObjectURL function: https://github.com/developit/jsdom-worker
Maybe another dependency needs to be added?
Error output:
My environment:
node v16.13.2
npm v8.1.2
babel config:
package.json snippet
src/setupTest.ts
The text was updated successfully, but these errors were encountered: