Skip to content
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 freeze, but works with vim-test #54

Closed
smichaud opened this issue Jun 24, 2021 · 5 comments
Closed

Jest test freeze, but works with vim-test #54

smichaud opened this issue Jun 24, 2021 · 5 comments

Comments

@smichaud
Copy link

Typescript, jest
Running a test freeze

Running it directly with vim-test works properly.

image

Log:

...
20:45:01 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:78 | Finished job with group update_positions
20:45:07 | INFO | MainThread | __init__.py:run_nearest:125 | Running nearest test in src/pipes/tests/PipeForm.test.tsx at line 55
20:45:07 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering should_render_form,_header_and_submit_button-4681889750434716771 as started
20:45:07 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:58 | Starting job with group should_render_form,_header_and_submit_button-4681889750434716771
20:45:07 | DEBUG | Thread-1 | processes.py:run:50 | Starting test process should_render_form,_header_and_submit_button-4681889750434716771 with command ['node_modules/.bin/react-scripts', 'test', '-t', '^<PipeForm> should render form, header and submit button$', 'src/pipes/tests/PipeForm.test.tsx'], cwd = None, env = None
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
20:45:08 | DEBUG | Thread-3 | handle.py:forward:85 | Writing data to output file
...

Log indicates running: ['node_modules/.bin/react-scripts', 'test', '-t', '^ should render form, header and submit button$', 'src/pipes/tests/PipeForm.test.tsx'], cwd = None, env = None

Running this command manually works properly: node_modules/.bin/react-scripts test -t '^<PipeForm> should render form, header and submit button$' src/pipes/tests/PipeForm.test.tsx

@rcarriga
Copy link
Owner

I'm going to need some more details unfortunately. Does this happen with any Jest test? I can see the program is outputting something, can you run :UltestAttach on the test line to see the current output? It'd be great also to see the full logs. If you've got sensitive information in them like file names, feel free to substitute with foo/bar.tsx etc.

@smichaud
Copy link
Author

Wow, I am kind of dumb. React script run using watch by default, so the process never stop.
Based on this issue you can add a --watchAll=false flag to disable it.

Using vim-test I can pass arguments when I run tests (:TestNearest --watchAll=false).
This does not seem to work with Ultest. Is there some way to add arguments to the runner? I think I might like for Pytest too from time to time.

@rcarriga
Copy link
Owner

Ah good to hear it's a simple solution 😄

To pass arguments right now you can't supply them to the command. You can set a variable though that works with vim-test as well

let test#javascript#jest#options = "--watchAll=false"

I could add the ability to add arguments to commands but it will be a bit involved so won't be a quick change.

@smichaud
Copy link
Author

Nice! For anybody else having the same problem, the runner is actually reactscripts, so I added this to my init.vim

let test#javascript#reactscripts#options = "--watchAll=false"
let test#javascriptreact#reactscripts#options = "--watchAll=false"
let test#typescript#reactscripts#options = "--watchAll=false"
let test#typescriptreact#reactscripts#options = "--watchAll=false"

No sure they are all required but 🤷‍♂️...

The ability to add arguments to commands is honestly "candy/nice-to-have".

@rebuilt
Copy link

rebuilt commented Aug 17, 2021

@smichaud Thank you. I was having the same issue. This helped me solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants