Skip to content

Commit 2fb7fc5

Browse files
authored
Switch to web-test-runner test suite (#73)
This switches out Jest for web-test-runner, which is the test suite that is recommended for web component building, especially from Lit: https://lit.dev/docs/tools/testing/ This replaces manual DOM testing manipulation and instead tests inside the browser environment instead. This is handy for picking up on exceptions that wouldn't be caught outside the browser -- I picked up on a couple just adding notification tests. The Lit starter kit has some more examples of tests: https://github.com/lit/lit-element-starter-js/blob/main/test/my-element_test.js I just added some to test the functionality. This still requires some mocking, as all imports do need to be JS modules -- CSS and JSON included in that. I've wanted to test this for the dashboard, but my environment was broken all day today, so I started testing here instead. We don't have any tests written yet anyways, so this is an easier place to start already, not to mention the footprint is smaller.
1 parent a584138 commit 2fb7fc5

27 files changed

+10363
-4401
lines changed

.circleci/config.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
version: 2.1
22

3+
orbs:
4+
browser-tools: circleci/[email protected]
5+
36
commands:
47
run-tests:
58
description: "Run test suite"
69
steps:
10+
- browser-tools/install-chrome
11+
- browser-tools/install-chromedriver
712
- checkout
813
- run: npm ci
914
- run: npm run test
@@ -37,7 +42,7 @@ jobs:
3742
- run-checks: {}
3843
test:
3944
docker:
40-
- image: "cimg/node:18.15.0"
45+
- image: "cimg/node:18.15.0-browsers"
4146
steps:
4247
- run-tests: {}
4348
build:
@@ -52,5 +57,4 @@ workflows:
5257
jobs:
5358
- checks
5459
- build
55-
# TODO re-enable the test suite checks as CI later.
56-
# - test
60+
- test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Display a nice tooltip when hovering internal links of the same documentation.
7070
- Make sure you have the correct version of Node.js installed (>= 18). You can use [asdf](https://github.com/asdf-vm/asdf) or [nvm](https://github.com/nvm-sh/nvm) for easier management of different Node.js versions.
7171
- Run `npm install` to install dependencies
7272
- Run `npm run dev` to start the local dev server. While this can run without a local Read the Docs development instance, not everything will work.
73+
- Run `npm test` to run the test suite, using web-test-runner. You can run also `npm run test:dev` to leave tests running in watch mode or `npm run test:debug` to manually test the suite in a browser.
7374

7475
----
7576

dist/readthedocs-addons.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/readthedocs-addons.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)