Skip to content

Commit

Permalink
Move redux-devtools-test-generator package (reduxjs#438)
Browse files Browse the repository at this point in the history
* Move from zalmoxisus/redux-devtools-test-generator

* Update package and links

* Fix CI
  • Loading branch information
zalmoxisus authored Dec 23, 2018
1 parent 4f6ac02 commit 2f91b87
Show file tree
Hide file tree
Showing 33 changed files with 2,378 additions and 49 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
sudo: false
language: node_js
node_js:
- "lts/*"
- "stable"
cache:
yarn: true
directories:
- "node_modules"
script:
- npm run build:all
- npm run lint
- npm test
- yarn build:all
- yarn lint
- yarn test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"devDependencies": {
"babel-eslint": "^10.0.0",
"eslint-plugin-react": "7.4.0",
"eslint-plugin-flowtype": "3.2.0",
"lerna": "3.4.2"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions packages/redux-devtools-test-generator/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015-loose", "stage-0", "react"]
}
3 changes: 3 additions & 0 deletions packages/redux-devtools-test-generator/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
demo
**/node_modules
18 changes: 18 additions & 0 deletions packages/redux-devtools-test-generator/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"jest": true,
"node": true
},
"rules": {
"prefer-template": 0,
"no-shadow": 0,
"comma-dangle": 0,
"react/sort-comp": 0
},
"parser": "babel-eslint",
"plugins": [
"react"
]
}
21 changes: 21 additions & 0 deletions packages/redux-devtools-test-generator/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Mihail Diordiev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions packages/redux-devtools-test-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Redux DevTools Test Generator
==============================

### Installation

```
npm install --save-dev redux-devtools-test-generator
```

### Usage

If you use [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension), [Remote Redux DevTools](https://github.com/zalmoxisus/remote-redux-devtools) or [RemoteDev](https://github.com/zalmoxisus/remotedev), it's already there, and no additional actions required.

With [`redux-devtools`](https://github.com/reduxjs/redux-devtools) and [`redux-devtools-inspector`](https://github.com/reduxjs/redux-devtools/packages/redux-devtools-inspector):

##### `containers/DevTools.js`

```js
import React from 'react';
import { createDevTools } from 'redux-devtools';
import Inspector from 'redux-devtools-inspector';
import TestGenerator from 'redux-devtools-test-generator';
import mochaTemplate from 'redux-devtools-test-generator/lib/redux/mocha'; // If using default tests.

const testComponent = (props) => (
<TestGenerator
expect={mochaTemplate.expect} wrap={mochaTemplate.wrap} useCodemirror
{...props}
/>
);

export default createDevTools(
<Inspector
tabs: defaultTabs => [...defaultTabs, { name: 'Test', component: testComponent }]
/>
);
```

Instead of `mochaTemplate.expect` and `mochaTemplate.wrap` you can use your function templates.

If `useCodemirror` specified, include `codemirror/lib/codemirror.css` style and optionally themes from `codemirror/theme/`.

### Props

Name | Description
------------- | -------------
`assertion` | String template or function with an object argument containing `action`, `prevState`, `curState` keys, which returns a string representing the assertion (see the [function](https://github.com/zalmoxisus/redux-devtools-test-generator/blob/master/src/redux/mocha/index.js#L1-L3) or [template](https://github.com/zalmoxisus/redux-devtools-test-generator/blob/master/src/redux/mocha/template.js#L1)).
[`wrap`] | Optional string template or function which gets `assertions` argument and returns a string (see the example [function](https://github.com/zalmoxisus/redux-devtools-test-generator/blob/master/src/redux/mocha/index.js#L5-L14) or [template](https://github.com/zalmoxisus/redux-devtools-test-generator/blob/master/src/redux/mocha/template.js#L3-L12)).
[`useCodemirror`] | Boolean. If specified will use codemirror styles.
[`theme`] | String. Name of [the codemirror theme](https://codemirror.net/demo/theme.html).

### License

MIT
91 changes: 91 additions & 0 deletions packages/redux-devtools-test-generator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "redux-devtools-test-generator",
"version": "0.5.1",
"description": "Generate tests for redux devtools.",
"main": "lib/index.js",
"files": [
"lib"
],
"scripts": {
"start": "webpack-dev-server",
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test",
"test": "jest --no-cache",
"prepare": "npm run clean && npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build"
},
"repository": {
"type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git"
},
"keywords": [
"redux",
"devtools",
"test",
"flux",
"react",
"hot reloading",
"time travel",
"live edit"
],
"author": "Mihail Diordiev <zalmoxisus@gmail.com> (https://github.com/zalmoxisus)",
"license": "MIT",
"bugs": {
"url": "https://github.com/reduxjs/redux-devtools/issues"
},
"homepage": "https://github.com/reduxjs/redux-devtools",
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^6.0.5",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.11.6",
"clean-webpack-plugin": "^0.1.15",
"css-loader": "^0.26.1",
"enzyme": "^2.6.0",
"enzyme-to-json": "^1.3.0",
"eslint": "^2.13.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.9.2",
"eslint-plugin-jsx-a11y": "^1.5.3",
"eslint-plugin-react": "^5.2.2",
"expect": "^1.20.1",
"export-files-webpack-plugin": "0.0.1",
"file-loader": "^0.10.0",
"html-webpack-plugin": "^2.28.0",
"jest": "^23.6.0",
"lodash.shuffle": "^4.2.0",
"nyan-progress-webpack-plugin": "^1.1.4",
"react-addons-test-utils": "^15.1.0",
"react-dom": "^15.1.0",
"react-redux": "^5.0.2",
"react-router": "^3.0.2",
"react-router-redux": "^4.0.8",
"redux": "^3.6.0",
"redux-devtools": "^3.3.2",
"redux-devtools-dock-monitor": "^1.1.1",
"redux-logger": "^2.8.1",
"remotedev-inspector-monitor": "^0.11.0",
"rimraf": "^2.5.2",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
},
"dependencies": {
"devui": "^1.0.0-0",
"es6template": "^1.0.4",
"javascript-stringify": "^1.2.0",
"jsan": "^3.1.3",
"object-path": "^0.11.1",
"prop-types": "^15.5.10",
"react": "^15.1.0",
"react-icons": "^2.2.3",
"simple-diff": "^1.3.0"
}
}
Loading

0 comments on commit 2f91b87

Please sign in to comment.