Your Quasar projects have the ability to add unit and e2e testing harnesses. This introduction will not go into details about how to write and use tests, for that please consult the specially prepared and maintained documentation at the testing repo at GitHub. If you are a beginner, consider reading one of the books in the “Further Reading” section.
High level overview
You can install multiple pre-rigged testing harnesses to your existing Quasar application by running a simple command. This command will pull and install a node module (with dependencies) into your project’s
package.json, place necessary configuration files as appropriate and if you so choose, it will also add script commands that expose some of the functionality of the respective harness. You can add multiple harnesses and even use them for your continuous integration pipelines - as appropriate.
Testing is not in and of itself hard. The most complicated part is setting up the testing harness. The trick lies in knowing what to test. If you are new to testing, it is absolutely imperative that you familiarize yourself with some of the concepts and patterns. There are some links for further reading at the end of this document page.
You can find the documentation of testing AEs at https://testing.quasar.dev or into
dev branch of quasar-testing repo.
You can find the documentation of testing AEs compatible with Quasar v1 into
qv1 branch of quasar-testing repo.
$ cd your-quasar-project $ quasar ext add @quasar/testing
The lightweight extension installer will ask you which testing harnesses you want to install. Then it will install the respective extensions for these harnesses, which you can configure as you like. It is how multiple testing harnesses are ideally managed within a Quasar project.
It will provide you with a new
quasar run command that you can use to execute test-runners - and even your HMR dev environment at the same time. This approach can, for example, be quite helpful if you need to pass quasar.ctx to the test runner…
# Example to run jest && dev server in pwa mode $ quasar test --unit jest --dev="-m pwa"
If you ever need to review your choices you can take a look at
If you don’t want to install the helper package, you don’t have to do so. You can install each test harness app extension individually. They are completely standalone, but you won’t have the
quasar test command functionality.
- Testing Vue.js Applications by Edd Yerburgh, the author of the
- Free Vue Testing Handbook
- Unit Testing Vue Router with Jest
- … add your suggestions here