csspin_frontend.jest
csspin_frontend.jest is a plugin that provides a task to run Jest tests
for the current project. It requires one or more jest.config.json (or
jest.config.js) files to be present in the project source tree.
The Jest plugin does not install Jest from npm, but uses the webmake of an existing instance.
The jest task is part of the “test” workflow and can be leveraged by
importing making use of csspin_workflows.stdworkflows.
How to setup the csspin_frontend.jest plugin?
For using the csspin_frontend.jsconfig plugin, a project’s spinfile.yaml
must at least contain the following configuration.
spinfile.yaml to use csspin_frontend.jsconfigplugin_packages:
- csspin-java
- csspin-ce
- csspin-frontend
- csspin-python
plugins:
- csspin_ce.mkinstance
- csspin_frontend.jest
python:
version: '3.11.9'
index_url: <URL to retrieve CE packages from>
node:
version: '18.20.0'
java:
version: '17'
The provisioning of the required virtual environment as well as the plugins
dependencies can be done via the well-known spin provision-command.
How to run the jest task using csspin_frontend.jest?
The jest requires the existence of a CE instance (see create new
instance).
jest pluginspin jest
Collecting coverage is as simple as running the jest task with the
--coverage option.
jest pluginspin jest --coverage
How to run jest tests as part of the “test” workflow?
The jest task is part of the “test” workflow and can be executed by running
the following command, assuming that the CE instance is already created and
csspin_workflows.stdworkflows is configured as follows:
csspin-workflows plugin-package to the spinfile.yaml plugin_packages:
- csspin-workflows
...
plugins:
- csspin-workflows.stdworkflows
...
The test workflow can be executed by running the following command after
provision and creation of a CE instance:
spin test
How to debug jest tests using csspin_frontend.jest?
The jest task supports the --debug option to run the tests in debug
mode, which starts listening and waits for a debugger to attach.
csspin_frontend.jest schema reference
- jest: 'object'
Configuration of the jest plugin.
- jest.coverage: 'bool'
Run jest with collecting coverage
- jest.coverage_opts: 'list'
List of options to pass to jest when running with coverage enabled.
- jest.opts: 'list'
List of options to pass to jest.
- jest.report_opts: 'list'
List of options to pass to jest when generating test reports.
- jest.source: 'str'
The source directory when looking for jest.config.json.
- jest.schema: 'object'
- jest.requires: 'object'
- jest.requires.spin: 'list'
- jest.requires.python: 'list'
- jest._requires: 'list'