Running plugin qunit tests separately


(David Taylor) #1

(Might be useful for other plugin developers so I thought I’d make a topic about it)

I’ve written a new rake task, which allows running qunit tests for a specific plugin. It follows the same syntax as the existing plugin:spec task.

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

If you prefer using the web interface for qunit, you can now append some variables to the url to filter by plugin. For example

http://localhost:3000/qunit?qunit_skip_core=1&qunit_single_plugin=discourse-chat-integration

(Angus McLeod) #2

@David_Taylor 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.

Thoughts?


(David Taylor) #3

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?


(Angus McLeod) #4

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?