Skip to content

Commit 5fc742e

Browse files
committed
Update tests, no longer suggest jsdom-global
- Changes in JSDOM integration (for use with mocha): - Don't expose `performance` (no longer required, now results in errors) - Expose `requestAnimationFrame` to `global` (used in mediawiki.loader) - No longer suggest jsdom-global. Remove tests with jsdom-global. - Update test packages (jest, mocha) - Don't run CI in node 14.x and 16.x (no longer compatible with Jest 30). - Run CI on node 22.x and 24.x.
1 parent d16023f commit 5fc742e

8 files changed

Lines changed: 3963 additions & 3612 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node-version: [14.x, 16.x, 18.x, 20.x]
14+
node-version: [18.x, 20.x, 22.x, 24.x]
1515
steps:
1616
- uses: actions/checkout@v3
1717
- uses: actions/setup-node@v3

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@ ESM:
5656
import 'mock-mediawiki/with-jsdom';
5757
```
5858

59-
Or even better, consider using [jsdom-global](https://www.npmjs.com/package/jsdom-global) which injects DOM APIs globally (similar to how Jest does it) and also gives you control over the JSDOM configuration options. Then do `require('mock-mediawiki')` or its ESM equivalent. That is,
60-
61-
```js
62-
require('jsdom-global')(undefined, { /*... jsdom config parameters ...*/ });
63-
global.performance = window.performance; // Required for node.js v14 and older, until https://github.com/rstacruz/jsdom-global/issues/59 is resolved
64-
require('mock-mediawiki');
65-
```
59+
If you need to customise JSDOM options, inline `with-jsdom.js` into your test harness and change the options as needed. A previous version of this README recommended the use of [jsdom-global](https://www.npmjs.com/package/jsdom-global). It is no longer advised because jsdom-global is unmaintained and appears to result in integration issues.
6660

6761
It is assumed that ESM tests undergo transformation to CommonJS as part of some build step. Use of this package with native Node.js ESM packages is not supported because of its internal reliance on `require()`.
6862

0 commit comments

Comments
 (0)