Running CI Tests Locally

I just opened my first PR (:tada:)
https://github.com/discourse/discourse/pull/12674

And unfortunately it failed one of the CI checks, specifically: core backend > Core RSpec. And the particular test it failed on is: TopicsController#invite when logged in when user is a group manager should attach group to the invite.

I want to reproduce this test failure locally so I can tell whether or not I’ve fixed the problem before committing new code.

However, I can’t find any documentation on running tests locally.

Can anyone get me started?

5 Likes

Found it here:
https://github.com/discourse/discourse/blob/master/docs/DEVELOPMENT-OSX-NATIVE.md#now-test-it-out

To run tests run

bundle exec rspec

Importantly, before doing this you should set your RAILS_ENV env variable to ‘test’

RAILS_ENV=test
3 Likes

Awesome!

Since your PR deals with frontend code only, I don’t think the test failure is related to it. It’s a backend failure, most likely a flakey test (i.e. a test that sometimes fails).

3 Likes

Super helpful to know, thanks Penar!

3 Likes