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 21, 2019
2 parents 50930bd + c4e67c7 commit d1739d1
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 118 deletions.
32 changes: 0 additions & 32 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
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
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

**A jest matcher for shallow rendered React component snapshots**

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

## About

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

This is a jest matcher that allows you to easily create shallow snapshots of React components will full support for:

* React.memo
Expand All @@ -18,9 +18,9 @@ This is a jest matcher that allows you to easily create shallow snapshots of Rea

The output of this matcher is far more informative than other existing solutions, providing context of memo wrapped components, fragments, etc, and does not require importing a renderer for each of your test files.

This relies on [react-shallow-renderer](https://www.npmjs.com/package/@jakesidsmith/react-shallow-renderer) under the hood, which you could use without the jest matcher if you prefer / are using another test suite.
This relies on [react-shallow-renderer](https://www.npmjs.com/package/@dabapps/react-shallow-renderer) under the hood, which you could use without the jest matcher if you prefer / are using another test suite.

Check out the [react-shallow-renderer](https://www.npmjs.com/package/@jakesidsmith/react-shallow-renderer) readme for some examples of the snapshot output.
Check out the [react-shallow-renderer](https://www.npmjs.com/package/@dabapps/react-shallow-renderer) readme for some examples of the snapshot output.

## Example

Expand All @@ -31,7 +31,7 @@ expect(<MyComponent />).toMatchReactShallowSnapshot();
## Install

```shell
npm i @jakesidsmith/jest-matcher-react-shallow-snapshot -S
npm i @dabapps/jest-matcher-react-shallow-snapshot -S
```

## Configuration
Expand All @@ -53,7 +53,7 @@ module.exports = {
If you don't already have a such a file you should create one, and then simply import this library in that file:

```js
import '@jakesidsmith/jest-matcher-react-shallow-snapshot';
import '@dabapps/jest-matcher-react-shallow-snapshot';
```

If you are using TypeScript, importing this file from your setup file should apply the types needed to call `.toMatchReactShallowSnapshot`. If it doesn't, then make sure that the setup file is included in your tsconfig.
Expand All @@ -65,3 +65,18 @@ Now you can simply render a react component and expect it to match your shallow
```jsx
expect(<MyComponent />).toMatchReactShallowSnapshot();
```

## Updating this fork from upstream

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

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

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

```shell
git fetch upstream
git pull upstream master
```
82 changes: 47 additions & 35 deletions package-lock.json

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

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@jakesidsmith/jest-matcher-react-shallow-snapshot",
"name": "@dabapps/jest-matcher-react-shallow-snapshot",
"version": "1.0.0",
"description": "A jest matcher for shallow rendered React component snapshots",
"main": "dist/index.js",
Expand All @@ -16,7 +16,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/jakesidsmith/jest-matcher-react-shallow-snapshot.git"
"url": "git+https://github.com/dabapps/jest-matcher-react-shallow-snapshot.git"
},
"keywords": [
"react",
Expand All @@ -28,11 +28,11 @@
"author": "Jake 'Sid' Smith",
"license": "MIT",
"bugs": {
"url": "https://github.com/jakesidsmith/jest-matcher-react-shallow-snapshot/issues"
"url": "https://github.com/dabapps/jest-matcher-react-shallow-snapshot/issues"
},
"homepage": "https://github.com/jakesidsmith/jest-matcher-react-shallow-snapshot#readme",
"homepage": "https://github.com/dabapps/jest-matcher-react-shallow-snapshot#readme",
"dependencies": {
"@jakesidsmith/react-shallow-renderer": "^1.0.0",
"@dabapps/react-shallow-renderer": "^1.0.0",
"@types/jest": ">=24",
"@types/react": ">=16",
"@types/react-dom": ">=16",
Expand All @@ -44,9 +44,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
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactShallowRenderer } from '@jakesidsmith/react-shallow-renderer';
import { ReactShallowRenderer } from '@dabapps/react-shallow-renderer';
import { toMatchSnapshot } from 'jest-snapshot';

expect.extend({
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 d1739d1

Please sign in to comment.