react-fix-it

Automagically generate tests from errors

  • Owner: MicheleBertoli/react-fix-it
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

React Fix It Build Status

Automagically generate tests from errors.

:warning: This package uses react-component-errors to wrap the lifecycle methods into a try...catch block, which affects the performance of your components. Therefore it should not be used in production.

How to use it

  • Enhance your components with fixIt
  • Write some bugs (or wait for your components to fail)
  • Open the console and copy the test snippet
  • Paste the code to reproduce the error
  • Fix the bugs and celebrate

Demo

https://michelebertoli.github.io/react-fix-it/

Preview

Installation

You can either install it with npm or yarn.

npm install --save-dev react-fix-it

or

yarn add --dev react-fix-it

Example

import React, { Component } from 'react'
import fixIt, { options } from 'react-fix-it'

// defaults to console.log
options.log = (test) => {
  console.warn(test)
  doWatheverYouWant(test)
}

class MyComponent extends Component {
  render() {
    return <div>Hello ⚛</div>
  }
}

export default fixIt(MyComponent)

:bulb: They easiest way to patch automatically all the components in development mode is by using babel-plugin-react-fix-it with the following configuration:

{
  "env": {
    "development": {
      "plugins": ["react-fix-it"]
    }
  }
}

Test

npm test

or

yarn test

Main metrics

Overview
Name With OwnerMicheleBertoli/react-fix-it
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2016-12-15 08:59:34
Pushed At2018-09-24 03:54:20
Last Commit At2016-12-24 14:05:50
Release Count5
Last Release Namev0.3.3 (Posted on 2016-12-24 14:05:50)
First Release Namev0.2.0 (Posted on )
用户参与
Stargazers Count1.9k
Watchers Count26
Fork Count21
Commits Count19
Has Issues Enabled
Issues Count2
Issue Open Count0
Pull Requests Count1
Pull Requests Open Count1
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private