npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

etr-tool

v1.0.3

Published

etr即为easy-test-redux,顾名思义就是用来轻松测试react+redux项目 众所周知,redux采用的是函数式编程思想,action+reducer的架构, 可以让我们轻松实现应用状态的管理,也就可以轻松实现redux的单元测试 但是集成测试还是需要我们手动写很多的测试案例,因此etr就是为了方便开发人员做**集成测试**而生的

Downloads

2

Readme

etr-tool

etr即为easy-test-redux,顾名思义就是用来轻松测试react+redux项目  
众所周知,redux采用的是函数式编程思想,action+reducer的架构,  
可以让我们轻松实现应用状态的管理,也就可以轻松实现redux的单元测试  
但是集成测试还是需要我们手动写很多的测试案例,因此etr就是为了方便开发人员做**集成测试**而生的

安装

npm install etr-tool --save-dev

使用

快捷键

  • ctrl + O 打开创建测试面板
  • ctrl + E 打开测试列表
  • ctrl + W 打开或者关闭 测试面板 和 测试列表

创建测试用例

etc_tool_1

测试创建的用例

etc_tool_2

介绍

etr-tool提供EtrComponent和EtrMiddleware,需要配合使用

EtrMiddleware

这个模块的功能其实就是收集action和reducer,具体用法如下
  • 带中间件:
import {EtrMiddleware} from 'etr-tool'
const createStoreWithMdware = applyMiddleware(
)(createStore);
var store = createStoreWithMdware(reducers,EtrMiddleware);
  • 不带中间件:
import {EtrMiddleware} from 'etr-tool'
var store = createStore(reducers,EtrMiddleware);

看了代码,大概就能意识到etrMiddleware其实是一个enhancer,重新封装了redux的store,内部也对root reducer进行了一次包裹,具体实现可以去看源码,代码很短

EtrComponent

这个模块是供开发者交互用,有本地模式和服务器模式

服务器模式(需要配合etr-tool-server(采用koa框架开发)使用)

服务器模式应该才是实际使用场景,能够把你的每一次测试用例都保存下来,等你代码改变后,可以轻松实现回归测试
    * host:服务器地址类似('http://locahost:3000')
    * user:{username:'',password:''}(用户名和密码)
    * projectId:项目ID
    <EtrComponent host={} user={} projectId={}/>

本地模式

所有信息会存在localStorage里
    <EtrComponent/>

注:确保EtrComponent渲染在根组件下

展望(后续会添加的功能)

  • 目前需要开发人员自己去判断测试是否通过,后续会加入通过比对redux的状态值来进行测试状态判断
  • 如果因为开发变动,导致状态发生了变动,解决需要重新更新状态再测的问题