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 DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
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 FEATURE: Hash API keys in the database (#8438) 2019-12-12 11:45:00 +00:00
assets.rake DEV: Use Terser for JS minification/compression if available (#12656) 2021-04-09 08:51:49 -04:00
auto_annotate_models.rake DEV: Automatically annotate plugin models alongside core models 2019-05-13 16:37:47 +01:00
autospec.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
avatars.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
backfill.thor DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
bookmarks.rake Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00
build.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
build_test_topic.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
categories.rake REFACTOR: Cleanup rake tasks based on feedback 2019-07-18 19:15:01 -06:00
cdn.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
db.rake FIX: rake db:validate_indexes was broken (#12463) 2021-03-24 08:53:01 +11:00
destroy.rake REFACTOR: Cleanup rake tasks based on feedback 2019-07-18 19:15:01 -06:00
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 FEATURE: Rake task to export groups (#9450) 2020-04-17 14:59:54 -07:00
groups.rake Make rubocop happy. 2019-05-13 09:55:44 +08:00
i18n.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
images.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
import.rake FEATURE: add new user option `skip_new_user_tips`. (#10437) 2020-08-14 19:10:56 +05:30
incoming_emails.rake FEATURE: Remove attachments and truncate raw field for incoming emails (#8253) 2019-10-30 16:54:35 +11:00
integration.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
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 FIX: maxminddb:get task no longer working 2019-10-04 09:47:33 +10:00
plugin.rake DEV: log rake plugin:update_all plugin_path on error (#12100) 2021-02-16 11:50:27 -08:00
populate.thor DEV: prevents populate task to crash (#8111) 2019-09-22 05:18:48 -07:00
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 DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
release_note.rake Include UI commits when generating release notes. (#12127) 2021-02-18 10:53:23 -05:00
rspec.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
s3.rake FIX: S3 rake task can ignore yarn.lock 2020-04-29 13:14:04 -04:00
scheduler.rake FIX: DistributedMutex (#7953) 2019-08-01 09:12:05 +01:00
search.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
site_settings.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
smoke_test.rake Dev: --dev option does nothing in yarn (#12032) 2021-02-10 19:19:47 -05:00
svg_icons.rake DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
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 FEATURE: Add support for secure media (#7888) 2019-11-18 11:25:42 +10:00
turbo.rake DEV: Add a verbose option to ./bin/turbo_rspec 2019-06-27 15:49:21 +01:00
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 DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00