Skip to content

Commit

Permalink
Merge pull request #1 from dabapps/scoping
Browse files Browse the repository at this point in the history
Scoping
  • Loading branch information
JakeSidSmith authored Mar 20, 2019
2 parents 9452577 + 4ad9172 commit 8db69f5
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 117 deletions.
32 changes: 0 additions & 32 deletions .circleci/config.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo: false

language: node_js

install:
- npm install

script:
- npm test
- npm run dist
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

**A shallow renderer for React components**

[![CircleCI](https://circleci.com/gh/JakeSidSmith/react-shallow-renderer.svg?style=svg)](https://circleci.com/gh/JakeSidSmith/react-shallow-renderer)

## About

This is a fork of [@jakesidsmith/react-shallow-renderer](https://github.com/jakesidsmith/react-shallow-renderer).

This is an alternative renderer to `react-test-renderer/shallow` with full support for:

* React.memo
Expand All @@ -18,16 +18,10 @@ This is an alternative renderer to `react-test-renderer/shallow` with full suppo

The output of this renderer is far more informative than other existing renderers, providing context of memo wrapped components, fragments, etc.

If you're using jest you may enjoy [jest-matcher-react-shallow-snapshot](https://www.npmjs.com/package/@jakesidsmith/jest-matcher-react-shallow-snapshot), which wraps this library for ease of use:

```jsx
expect(<MyComponent />).toMatchReactShallowSnapshot()
```

## Install

```shell
npm i @jakesidsmith/react-shallow-renderer -S
npm i @dabapps/react-shallow-renderer -S
```

## Usage
Expand All @@ -36,7 +30,7 @@ Example with jest:

```jsx
import React from 'react';
import { ReactShallowRenderer } from '@jakesidsmith/react-shallow-renderer';
import { ReactShallowRenderer } from '@dabapps/react-shallow-renderer';
import MyComponent from './path';

describe('MyComponent', () => {
Expand Down Expand Up @@ -181,3 +175,18 @@ const MyComponent = () => <div />;
export default connect(mapStateToProps)(React.memo(MyComponent));
```

## Updating this fork from upstream

Ensure you have added a remote upstream in git e.g.

```shell
git remote add upstream [email protected]:JakeSidSmith/react-shallow-renderer.git
```

Create a new branch (from master) and run the following to pull changes from [upstream](https://github.com/jakesidsmith/react-shallow-renderer):

```shell
git fetch upstream
git pull upstream master
```
76 changes: 44 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@jakesidsmith/react-shallow-renderer",
"name": "@dabapps/react-shallow-renderer",
"version": "1.0.0",
"description": "A shallow renderer for React components",
"main": "dist/index.js",
Expand All @@ -15,7 +15,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/jakesidsmith/react-shallow-renderer.git"
"url": "git+https://github.com/dabapps/react-shallow-renderer.git"
},
"keywords": [
"react",
Expand All @@ -27,9 +27,9 @@
"author": "Jake 'Sid' Smith",
"license": "MIT",
"bugs": {
"url": "https://github.com/jakesidsmith/react-shallow-renderer/issues"
"url": "https://github.com/dabapps/react-shallow-renderer/issues"
},
"homepage": "https://github.com/jakesidsmith/react-shallow-renderer#readme",
"homepage": "https://github.com/dabapps/react-shallow-renderer#readme",
"dependencies": {
"@types/react": ">=16",
"@types/react-dom": ">=16",
Expand All @@ -42,9 +42,7 @@
"prettier": "^1.16.4",
"ts-jest": "^24.0.0",
"tslint": "^5.13.1",
"tslint-config-prettier": "^1.18.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0",
"tslint-config-dabapps": "github:dabapps/tslint-config-dabapps#v0.5.3",
"typescript": "^3.3.3333"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions tests/to-json/forward-ref.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { compare } from '../helpers/compare';
describe('ReactShallowRenderer', () => {
const ForwardRefComponentReturnsArray: React.ForwardRefExoticComponent<
React.RefAttributes<HTMLParagraphElement>
// tslint:disable-next-line:variable-name
> = React.forwardRef((((_props: {}, ref: React.Ref<HTMLParagraphElement>) => [
<p key={1} ref={ref}>
First
Expand Down
38 changes: 2 additions & 36 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
{
"extends": [
"tslint:recommended",
"tslint-eslint-rules",
"tslint-react",
"tslint-config-prettier"
],
"rules": {
"variable-name": [true, "allow-leading-underscore", "ban-keywords"],
"strict-type-predicates": true,

"object-literal-sort-keys": false,
"interface-name": false,

"triple-equals": true,
"no-constant-condition": true,
"no-console": true,
"no-debugger": true,
"no-extra-boolean-cast": true,
"no-eval": true,
"no-shadowed-variable": true,

"radix": true,
"curly": true,
"no-switch-case-fall-through": true,
"switch-default": true,

"no-var-keyword": true,
"no-unused-expression": true,
"no-use-before-declare": true,

"jsx-boolean-value": [true, "never"],
"jsx-key": true,
"jsx-no-string-ref": true,
"jsx-self-close": true,
"jsx-no-bind": true,
"jsx-no-lambda": true
}
"tslint-config-dabapps"
]
}

0 comments on commit 8db69f5

Please sign in to comment.