Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Jest preset for testing Preact apps

License

NotificationsYou must be signed in to change notification settings

preactjs/jest-preset-preact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jest preset containing all required configuration for writing tests forpreact.

Features:

  • Transpiles JSX toh()
  • Aliases forreact imports to point topreact/compat
  • Automatically serialize PreactVNodes in snapshots
  • Stub style imports (.css,.less,.sass/scss, etc)
  • Add typeahead preview for filtering in jest's watch mode

Usage

Install it via npm or yarn:

npm install --save-dev jest-preset-preact# or via yarnyarn add -D jest-preset-preact

...and add the preset to yourjest.config.js file.

// jest.config.jsmodule.exports={preset:'jest-preset-preact',};

You can override the default Babel config by providing your own Babel config file:

// babel.config.jsmodule.exports={env:{test:{plugins:[["@babel/plugin-transform-react-jsx",{runtime:"automatic",importSource:"preact"}]]}}}

This, for example, would enable the runtime JSX transform instead of the classic.

License

MIT, seethe LICENSE file.

About

Jest preset for testing Preact apps

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp