Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: migrate from karma (deprecated) to web-test-runner #210

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"no-restricted-imports": ["error", {
"name": "openpgp",
"message": "Please import from 'lib/openpgp' instead."
}],
"no-restricted-imports": ["error",
{
"name": "openpgp",
"message": "Please import from 'lib/openpgp' instead."
},
{
"name": "chai",
"message": "Please import from 'test/setupMocha' instead."
}
],
"no-multiple-empty-lines": ["error"],
"no-trailing-spaces": ["error"],
"eol-last": ["error"],
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '>=22' # fn.globSync support needed for wtr setup

- name: Install dependencies
run: npm ci
Expand All @@ -30,10 +32,13 @@ jobs:
run: npx playwright install --with-deps chromium

- name: Install Firefox
run: npx playwright install --with-deps firefox
run: npx playwright install --with-deps firefox-beta

- name: Install Webkit
# do not install webkit on ubuntu, since the X25519 WebCrypto implementation
# has issues, see https://github.com/openpgpjs/openpgpjs/pull/1829 .
- if: ${{ matrix.runner == 'macos-latest' }}
name: Install Webkit
run: npx playwright install --with-deps webkit

- name: Run tests
run: npm test
run: npm run test:ci
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ const sessionKey = await decryptSessionKey({

## Testing
Headless Chrome (or Chromium), Firefox and Webkit are used for the tests.
To install any missing browsers automatically, you can run `npx playwright install --with-deps <chromium|firefox|webkit>`. Alternatively, you can install them manually as you normally would on your platform.
If you'd like to test on a subset of browsers, use e.g. `npm test -- --browsers ChromeHeadless,FirefoxHeadless`.
To install any missing browsers automatically, you can run `npx playwright install --with-deps <chromium|firefox|webkit|firefox-beta>`. Alternatively, you can install them manually as you normally would on your platform.

The available test commands are:

- `npm run test`: all browsers are tested in headless mode.
- `npm run test:ci`: similar to `test`, but beta browser versions are used if the vendor provides them; also, Webkit is skipped if not installed.
- `npm run test:debug`: opens up a browser instance in your default browser to allow debugging the tests live

98 changes: 0 additions & 98 deletions karma.conf.js

This file was deleted.

Loading