discourse/lib/tasks
Osama Sayegh cd24eff5d9
FEATURE: Introduce theme/component QUnit tests (take 2) (#12661)
This commit allows themes and theme components to have QUnit tests. To add tests to your theme/component, create a top-level directory in your theme and name it `test`, and Discourse will save all the files in that directory (and its sub-directories) as "tests files" in the database. While tests files/directories are not required to be organized in a specific way, we recommend that you follow Discourse core's tests [structure](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/tests).

Writing theme tests should be identical to writing plugins or core tests; all the `import` statements and APIs that you see in core (or plugins) to define/setup tests should just work in themes.

You do need a working Discourse install to run theme tests, and you have 2 ways to run theme tests:

* In the browser at the `/qunit` route. `/qunit` will run tests of all active themes/components as well as core and plugins. The `/qunit` now accepts a `theme_name` or `theme_url` params that you can use to run tests of a specific theme/component like so: `/qunit?theme_name=<your_theme_name>`.

* In the command line using the `themes:qunit` rake task. This take is meant to run tests of a single theme/component so you need to provide it with a theme name or URL like so: `bundle exec rake themes:qunit[name=<theme_name>]` or `bundle exec rake themes:qunit[url=<theme_url>]`.

There are some refactors to how Discourse processes JavaScript that comes with themes/components, and these refactors may break your JS customizations; see https://meta.discourse.org/t/upcoming-core-changes-that-may-break-some-themes-components-april-12/186252?u=osama for details on how you can check if your themes/components are affected and what you need to do to fix them.

This commit also improves theme error handling in Discourse. We will now be able to catch errors that occur when theme initializers are run and prevent them from breaking the site and other themes/components.
2021-04-12 15:02:58 +03:00
..
add_topic_to_quotes.rake
admin.rake DEV: Rake task for creating admin should ask for full name if required (#11096) 2020-11-02 11:12:42 +01:00
api.rake
assets.rake DEV: Use Terser for JS minification/compression if available (#12656) 2021-04-09 08:51:49 -04:00
auto_annotate_models.rake
autospec.rake
avatars.rake
backfill.thor
bookmarks.rake Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00
build_test_topic.rake
build.rake
categories.rake
cdn.rake
db.rake FIX: rake db:validate_indexes was broken (#12463) 2021-03-24 08:53:01 +11:00
destroy.rake
docker.rake REFACTOR: Move javascript tests inside discourse app 2020-10-02 11:29:36 -04:00
emails.rake FIX: emails.rake-use domain when sending mail test (#12188) 2021-02-23 14:16:51 -03:00
emoji.rake DEV: Remove JoyPixels emoji option (#12197) 2021-02-26 07:44:52 -05:00
export.rake
groups.rake
i18n.rake
images.rake
import.rake FEATURE: add new user option skip_new_user_tips. (#10437) 2020-08-14 19:10:56 +05:30
incoming_emails.rake
integration.rake
javascript.rake DEV: Fix build due to highlight.js branch issue (#12441) 2021-03-18 18:21:23 -04:00
log.rake FIX: whoops, linting 2020-09-03 12:10:11 +01:00
maxminddb.rake
plugin.rake DEV: log rake plugin:update_all plugin_path on error (#12100) 2021-02-16 11:50:27 -08:00
populate.thor
posts.rake DEV: ensure 'posts:reorder_posts' rake task work on single topic 2020-08-04 14:57:49 +02:00
qunit.rake FEATURE: Introduce theme/component QUnit tests (take 2) (#12661) 2021-04-12 15:02:58 +03:00
redis.rake
release_note.rake Include UI commits when generating release notes. (#12127) 2021-02-18 10:53:23 -05:00
rspec.rake
s3.rake
scheduler.rake
search.rake
site_settings.rake
smoke_test.rake Dev: --dev option does nothing in yarn (#12032) 2021-02-10 19:19:47 -05:00
svg_icons.rake
tags.rake FEATURE: Support append when bulk tagging via rake (#9978) 2020-06-04 09:33:48 -04:00
themes.rake FEATURE: Introduce theme/component QUnit tests (take 2) (#12661) 2021-04-12 15:02:58 +03:00
topics.rake
turbo.rake
typepad.thor FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
uploads.rake FIX: uploads:fix_missing_s3 rake task used wrong SHA1 (#12495) 2021-03-25 11:35:29 +01:00
users.rake