Skip to content

nvh95/jest-preview

main
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Mar 13, 2022
Apr 3, 2022
Mar 23, 2022

Jest Preview Logo

Jest Preview

Debug your Jest tests. Effortlessly. ๐Ÿ› ๐Ÿ–ผ

Jest Preview Demo

Try Jest Preview Online. No downloads needed!

All Contributors

npm npm Mentioned in Awesome Jest

PRs Welcome Best of JS Discord

Why jest-preview

When writing tests using Jest, we usually debug by reading the HTML code. Sometimes, the HTML is too complicated to visualize the UI in our head. jest-preview initiates a server and serve your HTML in a browser, then you can see your actual UI visually, which helps you debug jest tests faster.

jest-preview is initially designed to work with jest and react-testing-library. The package is framework-agnostic, and you can use it with any testing libraries.

Features

  • ๐Ÿ‘€ Preview your actual app's HTML in a browser in milliseconds.
  • ๐Ÿ”„ Auto reload browser when execute preview.debug().
  • ๐Ÿ’… Support CSS:
  • ๐ŸŒ„ Support viewing images.

How to use jest-preview in 2 lines of code

+import preview from 'jest-preview';

describe('App', () => {
  it('should work as expected', () => {
    render(<App />);
+    preview.debug();
  });
});

Or:

+import { debug } from 'jest-preview';

describe('App', () => {
  it('should work as expected', () => {
    render(<App />);
+    debug();
  });
});

You also need to start the Jest Preview Server by running the CLI jest-preview. Please continue to read Usage for the details instructions.

Examples

Feedback

Your feedback is very important to us. Please help jest-preview becomes a better software by submitting a feedback here.

Installation

See the Installation Guide on Jest Preview official website.

Usage

See the Usage Guide on Jest Preview official website.

Advanced configurations

Jest Preview comes with Pre-configured transformation. However, in more advanced use cases where you have custom code transformation, check out the Code Transformation Guide.

Upcoming features

  • Support more css-in-js libraries.
  • Multiple preview.
  • You name it.

Support

Please file an issue, or add a new discussion if you encounter any issues.

You can also mention @JestPreview or @hung_dev on twitter if you want to have some more discussions or suggestions.

We also have a Discord server: Discord

Contributing

We can't wait to see your contributions. See the Contribution Guide at CONTRIBUTING.md

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Hung Viet Nguyen

๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก

Truong Nguyen

๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก

Viet Huu Doan

๐ŸŽจ

HarveyNguyen

โš ๏ฟฝ?

Matt Murphy

๐Ÿ“–

Traitanit Huangsri

๐Ÿ’ป

Thanh Son Nguyen

๐Ÿ’ป ๐Ÿ’ก ๐Ÿ“–

Minh Nguyen

๐Ÿ“–

Kyle(Tรฌnh Vลฉ)

๏ฟฝ?๏ฟฝ

Makoto Tateno

๐Ÿ“–

Abhishek Rawat

๐Ÿ“–

Huynh Duc Duy

๐Ÿ’ป

Nuno Casteleira

๏ฟฝ?๏ฟฝ

sundaycrafts

๐Ÿ’ป

LunduoCai

๏ฟฝ?๏ฟฝ

huyenuet

โš ๏ฟฝ?

Bennett Dams

๐Ÿ“–

Steven Rosato

๐Ÿ’ก ๏ฟฝ?๏ฟฝ

nhducit

๐Ÿค”

Benoit GRASSET

๏ฟฝ?๏ฟฝ

Sergii Kirianov

๐Ÿ“– ๐Ÿ–‹ ๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

Star history

Star History Chart

License

This is open source software

MIT

Sponsors

If you like the project and want us continue to develop it, please sponsor us via Open Collective, starting from $1.

Bronze Sponsor ๐Ÿฅ‰ and Silver Sponsor ๐Ÿฅˆ on Open Collective will have your logo on README.md and www.jest-preview.com, for the Gold Sponsor ๐Ÿฅ‡ and Diamond Sponsor ๐Ÿ’Ž, please contact the author.

Bronze Sponsor ๐Ÿฅ‰