8000 GitHub - onpaws/jest-preview: Debug your Jest tests. Effortlessly.πŸ› πŸ–Ό
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

onpaws/jest-preview

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jest Preview Logo

Debug your Jest tests. Effortlessly. πŸ› πŸ–Ό

Jest Preview Demo

Try Jest Preview Online. No downloads needed!

All Contributors

npm npm

PRs Welcome 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

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();
  });
});

Examples

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.

Run jest-preview locally

Install dependencies

npm install

To see the real demo app

npm run dev

Run jest and jest-preview simultaneously

npm run test

Open chrome at http://localhost:3336 to see the preview

However, it's recommend to run jest and jest-preview separately

npm run server # Run jest-preview server
npm run test:only # Run jest

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

πŸ“–

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

License

This is open source software

MIT

About

Debug your Jest tests. Effortlessly.πŸ› πŸ–Ό

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 44.0%
  • JavaScript 43.0%
  • AppleScript 7.5%
  • CSS 4.6%
  • HTML 0.9%
0