Review main Merged

81040[TASK] Migrate JavaScript unit test from karma to @web/test-runner

Benjamin Franzke CR +2 V +2 Nightmare +3055 −1589 updated 09/25/23, 13:01

Commit message

The karma unit testing framework has been deprecated and
suggests to use modern alternatives instead.
We use one of the recommended alternatives named @web/test-runner
which is toolset by the modern-web.dev and open-wc.org initiatives.
It is based on mocha and es-dev-server, which allows to run our
JavaScript modules natively in the browser
(without having to bundle them via rollup).

Note that compiled test files have been removed from the
source tree, since we configure es-dev-server to transpile
them on demand, allowing error output from tests to be
using original line numbers and unmangled identifiers.

The tests are executed in chrome by default (locally and CI).
They can be executed via:

  # Run once
  npm run test

  # Run tests whenever files change
  npm run watch:build
  npm run watch:test

  # Open browser with devtools and debug mode activated
  MODE=dev npm run watch:test -- --debug

Configuration is prepared to run in other browsers via playwright.
Example:

  # https://playwright.dev/docs/browsers#install-system-dependencies
  npx playwright install --with-deps
  BROWSERS=chrome,chromium,firefox,webkit npm run test

Commands executed:

  npm remove \
    karma \
    karma-chrome-launcher \
    karma-coverage \
    karma-jasmine \
    karma-junit-reporter \
    karma-rollup-preprocessor \
    jasmine-core \
    @types/jasmine

  npm install --save-dev \
    @web/test-runner \
    @web/test-runner-playwright \
    @web/dev-server-import-maps \
    @web/dev-server-esbuild \
    @open-wc/testing \
    sinon

  git rm -rf \
    typo3/sysext/core/Tests/JavaScript \
    typo3/sysext/backend/Tests/JavaScript

  npm run build

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 49

Show 29 more files

Review log 1933

Show 48 earlier messages
  1. Benjamin Franzke uploaded patch set 1 09/18/23, 10:05

  2. core-ci voted on patch set 1 V -1 09/18/23, 10:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46651

  3. Benjamin Franzke uploaded patch set 2 V -1 09/19/23, 15:38

  4. core-ci voted on patch set 2 V -1 09/19/23, 15:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46799

  5. Benjamin Franzke uploaded patch set 3 V -1 09/20/23, 04:29

  6. core-ci voted on patch set 3 V +1 09/20/23, 04:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46838

  7. Benjamin Franzke uploaded patch set 4 V +1 09/20/23, 06:18

  8. core-ci voted on patch set 4 V +1 09/20/23, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46839

  1. Benjamin Franzke uploaded patch set 5 V +1 09/20/23, 06:53

  2. core-ci voted on patch set 5 V +1 09/20/23, 07:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46843

  3. Benjamin Franzke uploaded patch set 6 V +1 09/20/23, 08:00

  4. Benjamin Franzke updated the commit message in patch set 7 09/20/23, 08:04

  5. core-ci voted on patch set 6 V -1 09/20/23, 08:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46852

  6. Benjamin Franzke uploaded patch set 8 09/20/23, 08:12

  7. core-ci voted on patch set 7 V -1 09/20/23, 08:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46853

  8. Benjamin Franzke uploaded patch set 9 09/20/23, 08:21

  9. core-ci voted on patch set 8 V -1 09/20/23, 08:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46855

  10. core-ci voted on patch set 9 V +1 09/20/23, 08:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46858

  11. Benjamin Franzke uploaded patch set 10 V +1 09/20/23, 08:41

  12. core-ci voted on patch set 10 V +1 09/20/23, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46859

  13. Benjamin Franzke uploaded patch set 11 V +1 09/20/23, 09:11

  14. core-ci voted on patch set 11 V +1 09/20/23, 09:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46862

  15. Benjamin Franzke uploaded patch set 12 V +1 09/20/23, 09:47

  16. core-ci voted on patch set 12 V +1 09/20/23, 09:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46866

  17. Benjamin Franzke uploaded patch set 13 V +1 09/20/23, 14:04

    Rebase
  18. core-ci voted on patch set 13 V +1 09/20/23, 14:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46894

  19. Andreas Kienast voted on patch set 13 V +1 CR +1 09/20/23, 14:21

  20. Benjamin Franzke uploaded patch set 14 CR +1 V +1 09/21/23, 17:05

    Rebase
  21. Benni Mack voted on patch set 14 V +1 CR +1 09/21/23, 17:15

  22. core-ci voted on patch set 14 V +1 09/21/23, 17:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47024

  23. Andreas Kienast voted on patch set 14 V +1 CR +1 09/25/23, 13:01

  24. Benjamin Franzke voted on patch set 14 V +2 CR +2 09/25/23, 13:01

  25. Benjamin Franzke merged patch set 15 09/25/23, 13:01