0.2.0 • Published 3 years ago

@gplane/svelte-jest v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

🚀 svelte-jest

npm.io npm.io

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