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

Can't see test outputs #34

Closed
sabbir-a9s opened this issue Jul 29, 2020 · 6 comments
Closed

Can't see test outputs #34

sabbir-a9s opened this issue Jul 29, 2020 · 6 comments
Labels
question Further information is requested

Comments

@sabbir-a9s
Copy link

sabbir-a9s commented Jul 29, 2020

After running cavy run-ios --skipbuild in a react-native project using expo, I'm getting the following lines in console:

cavy: Found an index.test.js entry point. Temporarily replacing index.js to run tests.
cavy: Running `mv index.js index.notest.js && mv index.test.js index.js`...
cavy: Listening on port 8082 for test results...

The app is running in a simulator already but I don't see any test output in neither expo metro bundler nor the terminal console. Any suggestions on how to solve this issue and see my test results?

@TheAlmightyBob
Copy link
Contributor

@sabbir0179 Assuming your index.test.js file is correctly configured to run the tests, did you reload the React Native app? When using the --skipbuild option, the tests won't automatically run until you manually trigger a reload.

@AbigailMcP AbigailMcP added the question Further information is requested label Aug 20, 2020
@hoshinaoshi
Copy link

@TheAlmightyBob
I have the same problem.
The detailed situation is like this.
pixielabs/cavy#195 (comment)

the tests won't automatically run until you manually trigger a reload.

How do you do this?
Run from CLI? or is it the Command + D in the React Native App?

@TheAlmightyBob
Copy link
Contributor

@hoshinaoshi cmd+D or cmd+R (or for Android emulator RR or cmd+M)

This isn't necessary if you don't use --skipbuild, since building/running will start the tests, but using --skipbuild just puts Cavy CLI in a passive mode listening for test results.

@hoshinaoshi
Copy link

@TheAlmightyBob
Thank you for your answer. and I solved it.:bow:

@sabbir0179

I made two mistakes.

  1. Optional entry point when running the test
    Expo specifies the entry point of the app because it is App.js.
    Also, the test file will be App.test.js.

  2. How to write App.test.js.
    Initially I thought I would export App.js and use it in App.test.js.
    But it wasn't.
    App.test.js simply wrapped the render part of App.js in a Tester component.

Here is the working code.
https://github.com/hoshinaoshi/cavyTest

@AbigailMcP
Copy link
Contributor

AbigailMcP commented Sep 29, 2020

Glad you got this sorted @hoshinaoshi :) and thanks for helping @TheAlmightyBob !

@hoshinaoshi - are there any parts of the documentation you think could be improved? I'm thinking a page specifically for Expo set up... we have a Custom Entry Point Guide but maybe this is too hidden away.

@AbigailMcP
Copy link
Contributor

@sabbir0179 - I'm closing this issue for now but please let me know whether you're still having trouble and I'll reopen.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants