Skip to content

Commit

Permalink
Migrate JavaScript tests from Karma to the Jasmine framework (#12754)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison authored Aug 9, 2024
1 parent 96b5117 commit e323826
Show file tree
Hide file tree
Showing 8 changed files with 1,305 additions and 1,691 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ on:
- ".github/workflows/nodejs.yml"
- "sphinx/themes/**.js"
- "tests/js/**"
- "karma.conf.js"
- "package.json"
- "package-lock.json"
pull_request:
paths:
- ".github/workflows/nodejs.yml"
- "sphinx/themes/**.js"
- "tests/js/**"
- "karma.conf.js"
- "package.json"
- "package-lock.json"

Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ Bugs fixed

Testing
-------

* #12141: Migrate from the deprecated ``karma`` JavaScript test framework to
the actively-maintained ``jasmine`` framework. Test coverage is unaffected.
Patch by James Addison.
13 changes: 5 additions & 8 deletions doc/internals/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ Style and type checks can be run as follows:
Unit tests
~~~~~~~~~~

Sphinx is tested using pytest_ for Python code and Karma_ for JavaScript.
Sphinx is tested using pytest_ for Python code and Jasmine_ for JavaScript.

.. _pytest: https://docs.pytest.org/en/latest/
.. _Karma: https://karma-runner.github.io
.. _Jasmine: https://jasmine.github.io/

To run Python unit tests, we recommend using :program:`tox`, which provides a number
of targets and allows testing against multiple different Python environments:
Expand Down Expand Up @@ -216,13 +216,10 @@ To run JavaScript tests, use :program:`npm`:
.. tip::

:program:`karma` requires a Firefox binary to use as a test browser.
:program:`jasmine` requires a Firefox binary to use as a test browser.

For Unix-based systems, you can specify the path to the Firefox binary using:

.. code-block:: shell
FIREFOX_BIN="/Applications/Firefox.app/Contents/MacOS/firefox" npm test
On Unix systems, you can check the presence and location of the ``firefox``
binary at the command-line by running ``command -v firefox``.

New unit tests should be included in the :file:`tests/` directory where necessary:

Expand Down
75 changes: 0 additions & 75 deletions karma.conf.js

This file was deleted.

Loading

0 comments on commit e323826

Please sign in to comment.