Qunit dans 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 « J'aime »

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 « J'aime »

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 « J'aime »

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 « J'aime »

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 « J'aime »

J’ai également reçu cette même erreur :

sur une installation fraîche de Pop!_OS 20.04 (sans Docker). Je l’ai résolue en exécutant

bundle exec bin/rake qunit:test

et j’ai remarqué qu’il avait installé plusieurs paquets npm avant de commencer l’exécution des tests. Une fois cela terminé, j’ai redémarré le serveur Rails et j’ai pu accéder à QUnit dans le navigateur via localhost:3000/qunit.

5 « J'aime »