← Back to context

Comment by rglover

3 months ago

When I implemented the test suite for my JS framework [1], I realized that there was a ton of cruft and noise in most test set ups. The solution? Just start a mirror of the app [2] and its database(s) on different ports and run the tests against that.

Do away with mocks/stubs in favor of just calling the code you're testing, intentionally using a test-only settings file (e.g., so you can use a dev account for third-party APIs). You can easily write clean up code in your test this way and be certain what you've built works.

[1] https://cheatcode.co/joystick

[2] A mirror of the app/db creates a worry-free test env that can easily be reset without messing up your dev env.