Run plugin qunit tests separately

When working on plugins, you will want to run its qunit tests by themselves without any core tests. To do this in the browser, visit https://localhost:4200/tests, click Abort to stop the autorun, then choose your plugin from the dropdown at the top of the screen.

After making your selection, you can bookmark the plugin-specific URL for quick future access.

To run a single plugin’s tests on the CLI (e.g. as part of a continuous integration job), you can use these rake tasks:

bin/rake "plugin:qunit" # Run all plugin qunit tests
bin/rake "plugin:qunit[discourse-chat-integration]" # Run a single plugin's qunit tests

@david As you’re the resident plugin qunit tests expert, I have a question :slight_smile:.

I’m now getting this error when running any qunit tests (core or plugin) in my local OS X dev environment. All subsequent tests fail.

Assertion Failed: TypeError: undefined is not a constructor (evaluating 'Object.assign({}, opts, (0, _baseApp.default)(name))')

The closest thing I can find is this discussion about PhantomJS not supporting es6 and needing a babel polyfil. No joy on that front as yet.



High praise indeed - not sure I can live up to that :laughing:

I have the latest discourse running natively on my mac, and the qunit tests work in PhantomJS (v2.1.1), so something must be different between our setups.

I think the babel stuff that Discourse does already should be enough to patch PhantomJS’s lack of support for ES6, although there may well be some quirks of phantomJS that screw things up.

Do the tests pass when you visit localhost:3000/qunit in your browser? How about removing all the non-core plugins and then running the tests?


Ah yes, being early in the morning :coffee: , I did not think of trying this

Funnily enough when I ran the tests in localhost:3000/quint they all passed.

Then, after running them in the browser, when I tried via the command line they all passed too.

… go figure. Maybe it’s because I also removed /tmp… not sure.

You’re working on moving off of PhantomJS aren’t you?


This is awesome, thanks for doing this work, so nice to be able to do this from the command line. Apologies for the slow reply :mantelpiece_clock: :wink: