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 „Gefällt mir“

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 „Gefällt mir“

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 „Gefällt mir“

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 „Gefällt mir“

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 „Gefällt mir“

Ich habe denselben Fehler ebenfalls erhalten:

auf einer frischen Installation von Pop!_OS 20.04 (ohne Docker). Ich habe das Problem behoben, indem ich folgenden Befehl ausgeführt habe:

bundle exec bin/rake qunit:test

Dabei habe ich festgestellt, dass vor dem Start der Tests eine Reihe von npm-Paketen installiert wurden. Sobald dies abgeschlossen war, habe ich den Rails-Server neu gestartet und konnte QUnit im Browser unter localhost:3000/qunit aufrufen.

5 „Gefällt mir“