An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        






@marko/jest



API Stability



TypeScript



Styled with prettier



Build status



Test Coverage



NPM Version



Downloads

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/.*(?