framework/js-packages/jest-config
2024-03-08 21:24:05 +01:00
..
.gitignore feat(jest): create jest config package for unit testing (#3678) 2023-02-08 22:02:40 +01:00
index.cjs feat: export registry (#3842) 2023-06-29 18:57:53 +01:00
LICENSE feat(jest): create jest config package for unit testing (#3678) 2023-02-08 22:02:40 +01:00
package.json chore: add script placeholders to allow running scripts globally 2023-06-07 11:19:59 +01:00
README.md chore: prepare @flarum/jest-config for release 2023-02-12 17:45:00 +01:00
setup-env.js tet: adapt frontend tests 2024-03-08 21:24:05 +01:00
shims.d.ts feat(jest): mithril component testing (#3679) 2023-02-10 23:02:50 +01:00
test-matchers.ts feat(jest): mithril component testing (#3679) 2023-02-10 23:02:50 +01:00
tsconfig.json feat(jest): mithril component testing (#3679) 2023-02-10 23:02:50 +01:00

Jest config for Flarum

This package provides a Jest 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:
module.exports = require('@flarum/jest-config')();
  • If you are using TypeScript, create tsconfig.test.json with the following content:
{
  "extends": "./tsconfig.json",
  "include": ["tests/**/*"],
  "files": ["../../../node_modules/@flarum/jest-config/shims.d.ts"]
}