https://github.com/flarum/jest-config
Jest configuration package to enable frontend testing in Flarum extensions
https://github.com/flarum/jest-config
Last synced: 3 months ago
JSON representation
Jest configuration package to enable frontend testing in Flarum extensions
- Host: GitHub
- URL: https://github.com/flarum/jest-config
- Owner: flarum
- License: mit
- Created: 2023-02-12T16:27:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T12:57:47.000Z (about 2 years ago)
- Last Synced: 2024-10-30T04:30:02.677Z (7 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest config for Flarum
This package provides a [Jest](https://jestjs.io/) config object to run unit & integration tests on Flarum extensions.
## Usage
* Install the package: `yarn add --dev @flarum/jest-config`
* Add `"type": "module"` to your `package.json`
* Add `"test": "yarn node --experimental-vm-modules $(yarn bin jest)"` to your `package.json` scripts
* Rename `webpack.config.js` to `webpack.config.cjs`
* Create a `jest.config.cjs` file with the following content:
```js
module.exports = require('@flarum/jest-config')();
```
* If you are using TypeScript, create `tsconfig.test.json` with the following content:
```json
{
"extends": "./tsconfig.json",
"include": ["tests/**/*"],
"files": ["../../../node_modules/@flarum/jest-config/shims.d.ts"]
}
```