svelte-jest Svelte Themes

Svelte Jest

Jest custom transformer for transforming Svelte.

🚀 svelte-jest

Jest custom transformer for transforming Svelte.

This package is inspired by svelte-jester, but this package is opinionated and simple: It requires svelte-preprocess to do transformation and it doesn't provide any configurations.

If you need to customize something, use svelte-jester instead.

🔥 Features

  • Source code is written in TypeScript.
  • No configuration (svelte.config.js) is required.
  • Better compatibility in some cases.
  • Leverage Jest's asynchronous transformers, so it's faster than those use child_process to transform Svelte code.

💿 Install

npm i @gplane/svelte-jest

🎨 Usage

Update your Jest configuration like this:

"transform": {
  "^.+\\.svelte$": "@gplane/svelte-jest"
}

If you're using TypeScript or other Jest transformers, please also add them properly:

"transform": {
  "^.+\\.svelte$": "@gplane/svelte-jest",
  "^.+\\.tsx?$": "ts-jest"
}

📜 License

MIT License

2020-present (c) Pig Fang

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes