Coder Social home page Coder Social logo

makotot / jest-preview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nvh95/jest-preview

0.0 1.0 0.0 3.6 MB

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

Home Page: https://www.jest-preview.com

License: MIT License

JavaScript 43.99% HTML 0.91% TypeScript 43.36% AppleScript 7.31% CSS 4.43%

jest-preview's Introduction

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

๐Ÿ“–

Kyle(Tรฌnh Vลฉ)

๐Ÿ›

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

License

This is open source software

MIT

jest-preview's People

Contributors

nvh95 avatar ntt261298 avatar allcontributors[bot] avatar imgbotapp avatar mattmurph9 avatar minhmo1620 avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.