Skip to content

Commit

Permalink
Merge pull request #2 from derekjuber/update_enzyme
Browse files Browse the repository at this point in the history
React 16 compatibility
  • Loading branch information
cdlewis authored Oct 20, 2017
2 parents 14b8365 + 11d75d7 commit e27c73d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snapshotter",
"version": "1.0.4",
"version": "2.0.0",
"description": "Snapshot testing for Tape",
"main": "dist/snapshotter.js",
"scripts": {
Expand All @@ -18,7 +18,7 @@
"url": "https://github.com/cdlewis/snapshotter.git"
},
"dependencies": {
"enzyme-to-json": "^1.4.5",
"enzyme-to-json": "^3.1.3",
"jest-diff": "^18.1.0",
"jest-file-exists": "^17.0.0",
"lodash": "^4.0.0",
Expand All @@ -32,15 +32,15 @@
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-jsx": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"enzyme": "^2.4.1",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.0",
"react": "~15.4.0",
"react-addons-test-utils": "^15.4.2",
"react-dom": "~15.4.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"tape": "^4.0.0"
},
"snapshotter": {
Expand Down
9 changes: 6 additions & 3 deletions test/snapshotter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import Adapter from 'enzyme-adapter-react-16'
import React from 'react'
import { shallow } from 'enzyme'
import Enzyme from 'enzyme'
import test from 'tape'
import { expectedJestDiff } from './fixtures'
import compareToSnapshot from '../src/snapshotter'

Enzyme.configure({ adapter: new Adapter() })

const TestClass = () => (
<div>
<p>Hello World</p>
Expand All @@ -12,7 +15,7 @@ const TestClass = () => (

test('snapshotter detects changes', (assert) => {
const mockTape = { fail: () => {} }
const shallowWrapper = shallow(<TestClass />)
const shallowWrapper = Enzyme.shallow(<TestClass />)
compareToSnapshot(mockTape, shallowWrapper, 'TestClass', {
write: (diff) => {
assert.deepEqual(diff, expectedJestDiff)
Expand All @@ -22,7 +25,7 @@ test('snapshotter detects changes', (assert) => {
})

test('snapshotter handles multiple files', (assert) => {
const shallowWrapper = shallow(<TestClass />)
const shallowWrapper = Enzyme.shallow(<TestClass />)
compareToSnapshot(assert, shallowWrapper, 'TestClass-Fixed')
assert.end()
})

0 comments on commit e27c73d

Please sign in to comment.