https://github.com/marko-js/jest
A preprocessor and preset to use Marko with Jest
https://github.com/marko-js/jest
Last synced: about 2 months ago
JSON representation
A preprocessor and preset to use Marko with Jest
- Host: GitHub
- URL: https://github.com/marko-js/jest
- Owner: marko-js
- License: mit
- Created: 2019-06-18T16:35:10.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-01T03:10:25.000Z (about 1 year ago)
- Last Synced: 2025-04-21T02:18:24.145Z (2 months ago)
- Language: TypeScript
- Size: 1.03 MB
- Stars: 8
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
@marko/jest
A preprocessor and preset to use Marko with Jest.
Templates are automatically compiled for the correct environment based on your Jest config. Browser tests are compiled to the dom api, and server tests to the html streaming api.# Installation
```console
npm install @marko/jest -D
```or
```console
yarn add @marko/jest -D
```# Examples
**jest.config.js**
```javascript
module.exports = {
preset: "@marko/jest/preset/browser",
};
```The above is roughly equivalent to:
```javascript
const { defaults } = require("jest-config");module.exports = {
// uses a webpack style resolver for older versions of Marko
resolver: "...",
// allows for stuff like file watching of `.marko` files
moduleFileExtensions: defaults.moduleFileExtensions.concat("marko"),
// preprocesses Marko files.
transform: { "\\.marko$": "@marko/jest/transform/browser" },
// transforms `.marko` files in node_modules as well
transformIgnorePatterns: ["node_modules/.*(?