Skip to content

Commit

Permalink
fix: improve warning so people know they can upgrade to 16.9.0 now
Browse files Browse the repository at this point in the history
Closes #281
  • Loading branch information
Kent C. Dodds committed Aug 8, 2019
1 parent 98b9605 commit d01dfa0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.5.4",
"@testing-library/dom": "^5.5.4"
"@babel/runtime": "^7.5.5",
"@testing-library/dom": "^5.6.1"
},
"devDependencies": {
"@reach/router": "^1.2.1",
"@testing-library/jest-dom": "^4.0.0",
"@types/react": "^16.8.23",
"@types/react-dom": "^16.8.4",
"@types/react": "^16.8.25",
"@types/react-dom": "^16.8.5",
"kcd-scripts": "^1.5.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
"react": "^16.9.0",
"react-dom": "^16.9.0"
},
"peerDependencies": {
"react": "*",
Expand Down
4 changes: 0 additions & 4 deletions src/__tests__/old-act.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ afterEach(() => {
console.error.mockRestore()
})

jest.mock('../react-dom-16.9.0-is-released', () => ({
reactDomSixteenPointNineIsReleased: true,
}))

jest.mock('react-dom/test-utils', () => ({
act: cb => {
cb()
Expand Down
6 changes: 3 additions & 3 deletions src/act-compat.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import * as testUtils from 'react-dom/test-utils'
import {reactDomSixteenPointNineIsReleased} from './react-dom-16.9.0-is-released'

const reactAct = testUtils.act
const actSupported = reactAct !== undefined
Expand All @@ -28,6 +27,7 @@ function asyncAct(cb) {
const originalConsoleError = console.error
console.error = function error(...args) {
/* if console.error fired *with that specific message* */
/* istanbul ignore next */
if (
args[0].indexOf(
'Warning: Do not await the result of calling ReactTestUtils.act',
Expand Down Expand Up @@ -75,8 +75,8 @@ function asyncAct(cb) {

if (isAsyncActSupported === false) {
console.error = originalConsoleError
/* istanbul-ignore-next */
if (!youHaveBeenWarned && reactDomSixteenPointNineIsReleased) {
/* istanbul ignore next */
if (!youHaveBeenWarned) {
// if act is supported and async act isn't and they're trying to use async
// act, then they need to upgrade from 16.8 to 16.9.
// This is a seemless upgrade, so we'll add a warning
Expand Down
2 changes: 0 additions & 2 deletions src/react-dom-16.9.0-is-released.js

This file was deleted.

0 comments on commit d01dfa0

Please sign in to comment.