# jsx-equals

> A unit testing tool for loosely comparing react element trees.

Latest version **0.4.0** (published 2015-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsx-equals
pnpm add jsx-equals
yarn add jsx-equals
bun add jsx-equals
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2015-10-07 |
| First published | 2015-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Frankie Bagnardi |
| Maintainers | greenjello |

## Links

- npm: https://www.npmjs.com/package/jsx-equals
- Repository: https://github.com/brigand/jsx-equals
- Homepage: https://github.com/brigand/jsx-equals#readme
- Issues: https://github.com/brigand/jsx-equals/issues
- npm.io page: https://npm.io/package/jsx-equals

## Dependencies (2)

- [deep-equal](https://npm.io/package/deep-equal.md) ^1.0.1
- [shallow-diff](https://npm.io/package/shallow-diff.md) 0.0.5

## Recent versions

- 0.4.0 (latest) — 2015-10-07
- 0.3.3 — 2015-09-12
- 0.3.2 — 2015-09-12
- 0.3.1 — 2015-09-12
- 0.3.0 — 2015-09-12
- 0.2.1 — 2015-09-12
- 0.2.0 — 2015-09-12

## README

A unit testing tool for loosely comparing react element trees.

Works well with the react test-utils addon's shallowRenderer. See examples/Box.test.js for a real example.
It's designed to make testing of simple components very easy and not get in your way. This is not
really suitable to larger complex views.


## Install

```sh
npm install --save-dev jsx-equals
```

## Usage

Pass it two arguments, the source and the pattern. To allow loose matching it is not associative.

You will generally hard code the right hand side, while the left hand side is generated e.g. by
shallowRenderer.

```js
jsxEquals(source, pattern);
```

Some variations:

```js
var jsxEquals = require('jsx-equals') // or use es6 import

// passes because b is unspecified
jsxEquals(
  <div a={1} b={2} />,
  <div a={1} />
);


// special shorthand for comparing without importing
jsxEquals(
  <Foo />
  <c-Foo a={1} />
);

// mark elements you don't care about with jsxEquals.ANY
jsxEquals(
  <div>
    <p />
    <span />
    <p />
  </div>,
  <div>
    <jsxEquals.ANY />
    <span />
    <jsxEquals.ANY />
  </div>
);
```

---
_Source: https://npm.io/package/jsx-equals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
