Qunit in Docker

Hi,
I followed the Beginners Guide to Install Discourse for Development using Docker, wrote my plugin and would now like to write tests for it. However, the qunit site is not accessible at http://localhost:3000/qunit (ERR_EMPTY_RESPONSE), but the Discourse installation on port 9292 is working fine. Do I need to pass some additional parameter to unicorn to make it run qunit as well? I ran boot_dev with the -p option, so that can’t be it.

If Discourse is on port 9292, then qunit will be there as well. http://localhost:9292/qunit

3000 is the default port, so maybe you changed some configuration?

3 Likes

Hi,
thanks a lot, that works. Port 9292 is the default for the Docker development environment, I did not change it. Maybe it makes sense to update the post at Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests to mention that the port is different for the Docker way.
Kind regards
Alexander

1 Like

Sorry, it still does not work. I do not get the previous error anymore and the page title shows up as QUnit Test Runner, but the page is empty and the console says: Uncaught Error: Sprockets::FileNotFound: couldn't find file 'qunit/qunit/qunit' with type 'application/javascript'.
Kind regards
Alexander

1 Like

I have no repro here, have you started from a clean slate? Try:

cd discourse
sudo rm -fr data
d/shutdown_dev
d/boot_dev --init

Then visit localhost:9292/qunit

Works fine here.

1 Like

Hi @sam,
thanks for your reply. I removed the data directory, pulled the latest master and started the container again, but the problem still persists. I am on macOS Catalina. If you need any other information, let me know.
Kind regards
Alexander

1 Like

I also was receiving this same error:

on a fresh Pop!_OS 20.04 install (non-docker). I resolved it by running

bundle exec bin/rake qunit:test

and I noticed it installed a bunch of npm packages before starting to run the tests. Once that was done, I started the rails server back up and I could access qunit in the browser with localhost:3000/qunit.

5 Likes