-
Notifications
You must be signed in to change notification settings - Fork 0
Using certain components hangs react-scripts test #146
Comments
The error you're pointing at though appears to be in your test code. Is this syntax correct? I'm not that familiar with typescript:
is that colon suppose to be there after the word container? Assuming it is, is there any additional setup you need to do to get Jest to run tests written in typescript? |
Yeah the syntax is correct, Regarding jest, im following https://jestjs.io/docs/getting-started#using-typescript and applied all their suggestions. Something worth mentioning, if I add the
|
Is there much "actual" typescript in your tests? Could you make it a normal JS file and see if you can get it running? |
I dunno - I'm just a bit stuck for ideas, without googling it more myself. Your second error just seems to be pointing at the typescript, that's nothing to do with this module. I'm all for helping out where I can, especially if we think this is something wrong with govuk-react-jsx, but I am not best placed to help with general typescript issues as you may have gathered by my ignorance! :-D |
I understand Andy :) Just tried my luck to see if yourself or someone you know came across using |
No worries, and sorry I couldn't be more helpful! Please do post back if you get any further though as it may be a useful reference for anyone encountering similar issues in the future. Conversely, if you don't make any headway at all, could you stick up a git repository with a minimal reproduction in? I could have a poke at it and see if I can get anywhere. |
Yeah, as a matter of fact, I made a headway. I installed and setup the
After setting up ts-jest, now Im getting the exact same error as an issue raised here - #107
|
Are you able to follow the threads in 107? Are you compiling this for serverside or clientside? It'll be to do with whether your setup is able to cope with the png import statements - whether your loaders are configured correctly. |
Im using an express app to serve the react app
Is there anyway I can confirm this. I dont use webpack or any other loader. Just a standard express app
|
Please see #107 (comment) This should resolve your issue. |
Thanks @andymantell - As fate would have it, just got news that apparently we have to scrap our react project for non-technical reasons :-D |
Wow, that escalated quickly! Well, good luck anyway :-) |
haha yeah ... it was an absolute co-incidence (apparently alpha assessment guys dont like react) |
yeah, that's definitely true. It's on my todo list to put a "health warning" at the top of this readme - this comes up in the X-Gov slack regularly. React often isn't the best tool for the job for building progressively enhanced gov services. Certainly inside gov I would reserve it for use cases that explicitly need to be a SPA. |
Hi @andymantell. I am using |
Hi @robValtech, please could you open a new issue so that everyone involved in this thread does not get email notifications, as your issue does not appear to be related to the original one in this thread. When you do, please could you provide a link to the repository that is not working, or if that's not possible, create a public repo with a minimal reproduction in it. Without this I am unable to diagnose anything really. "Officially" I don't support this repository any more, but I don't mind having a quick look to see if there's anything obvious. Also I would encourage you to look at #102 and #103 to see if there's any hints there that might help you - there are various demos linked to from those threads which you could compare to your solution. Thanks, |
Hi @andymantell , thanks so much for your reply, I really appreciate it knowing you must be very busy! The issue I'm experiencing is more like the one raised in this thread - Jest stuck on tests in [RUN], and never finish. I've managed to solve the issues already discussed on #102 and #103. I'm happy to open a new issue, with a public repro example. Many thanks. |
Hi Andy,
When running my jest tests, the test which uses components like Tabs, Header, Accordion etc fails with the following error:
My Node version: v17.9.0
My npm version: 8.5.5
govuk-react-jsx: "^7.0.1"
not sure if this will help but all these components have this in common - importing from
await import('govuk-frontend/govuk/components/...'
).What I've tried
I've followed your solution to a similar problem here - #109 (comment) referring this repo https://github.com/SamChatfield/govuk-react-demo. Added the presets within
babel.config.json
and added thetransformIgnorePatterns
etc. Unfortunately it didnt help but rather gave a new errorPlease let me know if you need anymore details to help narrow down the issue! Your help is very much appreciated!
The text was updated successfully, but these errors were encountered: