snapguidist

Snapshot testing for React Styleguidist

Github星跟蹤圖

Build Status
NPM version
tested with jest

Jest Snapshot Testing for React Styleguidist.

Demo

Demo

Getting Started

To add snapguidist to your react-styleguidist configuration, follow these steps:

  1. install the package using yarn or npm:
yarn add --dev snapguidist
  1. enhance the webpack configuration in styleguide.config.js:
+const snapguidist = require('snapguidist');
-module.exports = {
+module.exports = snapguidist({
  components: 'src/components/**/[A-Z]*.js',
  defaultExample: true,
  webpackConfig: {
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          exclude: /node_modules/,
          loader: 'babel-loader',
        },
        {
          test: /\.css$/,
          loader: 'style-loader!css-loader',
        },
      ],
    },
  },
-};
+});

Migrate to v4

In v4, snapshots have been renamed to .sg (as opposed to .snap) to avoid conflicts with Jest, and improve compatibility with create-react-app.

Once upgraded to v4, please run yarn test -u to remove the old snapshots (new ones will be automatically generated on the next run)
or the following commands to rename them:

cd .snapguidist/__snapshots/
for old in *.snap; do git mv $old `basename $old .snap`.sg; done

Example

To run the example, install the dependencies and start it:

cd example
yarn install
yarn start

Development

Any contribution to snapguidist is highly appreciated.

Run the following command from the root folder to enable the hot-reload:

yarn build:watch & yarn start

Credits

Logo by @SaraVieira

主要指標

概覽
名稱與所有者styleguidist/snapguidist
主編程語言JavaScript
編程語言JavaScript (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2016-12-10 07:34:12
推送於2018-08-17 10:25:47
最后一次提交2018-08-17 12:25:29
發布數18
最新版本名稱v4.0.0 (發布於 2018-08-17 12:25:31)
第一版名稱v0.1.0 (發布於 )
用户参与
星數288
關注者數4
派生數36
提交數71
已啟用問題?
問題數21
打開的問題數5
拉請求數14
打開的拉請求數0
關閉的拉請求數5
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?