ReactStateMuseum
ReactStateMuseum copied to clipboard
🧹 Get long-running tests clean
Looks like 3 React failures and 1 react-native failure.
yarn test:all
is currently failing with such:
@GantMan I took this one, but I only managed to fix the React examples. I couldn't run the React Native examples properly in order to see what fails. I tried executing the same commands from test_react_native_directory.js
:
$ react-native build
Scanning folders for symlinks in /home/me/workspace/ReactStateMuseum/ReactNative/ApolloLinkState/node_modules (18ms)
Unrecognized command 'build'
Run react-native --help to see list of all available commands
Happy Hacktoberfest!
P.S. I ran out of space on disk when first running the exhaustive tests. :sweat_smile: I think it uses > 10GB of space for all the dependencies of all the examples. What do you think about adjusting the test scripts to clean up each example after running it?
P.P.S. Since most of the examples reuse the same setup (such as create-react-app), I was wondering if it wouldn't be a good use for Yarn Workspaces. What do you think?
I ❤️the idea of cleanup as you go! I've never used Yarn Workspaces but that sounds great, too!
Feel free to create the ticket and I'll assign it to you. Happy Hacktoberfest!
@GantMan it's already been 1 year. :open_mouth:
I took the opportunity of a new Hacktoberfest to implement my proposal from last year with "cleanup as you go".
Also, while working on this, I noticed some examples are not passing. I will try to fix them in a separate PR.
Okay, so I analyzed the failing examples.
All the failing React examples are failing because of missing tests:
- overmind
- react-recomponent
- react-recontext
- redux-and-context
- reim
- undux
An easy solution would be to drop the yarn test
check from the exhaustive test suite. Otherwise, it should be mandatory to provide some tests when implementing new examples. Or it could be mandatory to use create-react-app for project setup in all examples.
All the failing React Native examples are failing because they use Expo and don't have the file structure which the tests expect:
- immer
- pure-store
- simple-remx
I'm not sure what the solution is in this case. I guess all examples should follow a standard project setup, but which one?
We can add test
scripts to those projects that return true. I wouldn't mind that.
Then we could tie everything with CI.
We can add
test
scripts to those projects that return true. I wouldn't mind that.
Yep, that sounds good for the web React examples. I'll start working on that.
How about the React Native examples? The test suite for React Native makes a few more assumptions about the file structure.
my guess is we'll have to make the tests detect if they are expo or not. No other way other than full conversions.
Then we could tie everything with CI.
Regarding CI, it would be nice to integrate the exhaustive test suite to run on every PR but it currently takes maybe too long to run. On my (albeit slow) machine just running the web React examples takes about 16 minutes.
I have one idea I want to explore that might speed up the suite a bit: sharing dependencies between each example app by running yarn install --modules-folder ../shared_node_modules
. This might speed up each yarn install
if some dependency versions are the same across multiple example apps. But if they are very different, it will just use up a lot of disk space. I'll let you know how it goes.
Just to follow up on my previous comment, my idea didn't pan out. I don't think yarn likes to share node_modules
like that and will clean the folder. Maybe there's another way to share dependencies, but I'm still not sure it would speed up the tests all that much.