Skip to content

Commit

Permalink
document usage with Jest v29, update jest/mocha versions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed May 27, 2023
1 parent 1d44123 commit 55d5c04
Show file tree
Hide file tree
Showing 4 changed files with 2,550 additions and 2,275 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ Licensed under the _Lesser_ General Public License. Can be used from any reposit
### Use with Jest

If you're using Jest, tweak your `jest.config.js` to include: (jsdom testEnvironment used to be the default till Jest v26)

For Jest v29:

Ensure you have the additional package [`jest-environment-jsdom`](https://www.npmjs.com/package/jest-environment-jsdom) installed (Jest no longer bundles this).
```
"testEnvironment": "jsdom",
"setupFilesAfterEnv": ["mock-mediawiki"],
"testEnvironmentOptions": {
// this is only needed if you plan to use mw.Api or mw.storage
"url": "https://test.wikipedia.org/"
}
```

For Jest v27:
```
"testEnvironment": "jsdom",
"setupFilesAfterEnv": ["mock-mediawiki"],
Expand Down
6 changes: 4 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['.'],
testURL: 'https://test.wikipedia.org/'
};
testEnvironmentOptions: {
url: 'https://test.wikipedia.org/'
}
};
Loading

0 comments on commit 55d5c04

Please sign in to comment.