david
(David Taylor)
July 26, 2017, 2:09pm
#1
(Might be useful for other plugin developers so I thought I’d make a topic about it)
https://github.com/discourse/discourse/pull/4985
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
13 Likes
angus
(Angus McLeod)
September 14, 2017, 1:11am
#2
@david As you’re the resident plugin qunit tests expert, I have a question .
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?
2 Likes
david
(David Taylor)
September 14, 2017, 1:28am
#3
High praise indeed - not sure I can live up to that
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?
3 Likes
angus
(Angus McLeod)
September 14, 2017, 3:55am
#4
david:
localhost:3000/qunit
Ah yes, being early in the morning , 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?
2 Likes