diff --git a/packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx b/packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx index cdda7f319..663e2bbe7 100644 --- a/packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx +++ b/packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx @@ -39,12 +39,13 @@ import describeMethods from './_helpers/describeMethods'; import describeHooks from './_helpers/describeHooks'; import { REACT16, + REACT17, is, } from './_helpers/version'; // The shallow renderer in react 16 does not yet support batched updates. When it does, // we should be able to go un-skip all of the tests that are skipped with this flag. -const BATCHING = !REACT16; +const BATCHING = !REACT16 && !REACT17; describe('shallow', () => { describe('top level entry points', () => { diff --git a/packages/enzyme-test-suite/test/_helpers/adapter.js b/packages/enzyme-test-suite/test/_helpers/adapter.js index 3d339c6b4..105dbf061 100644 --- a/packages/enzyme-test-suite/test/_helpers/adapter.js +++ b/packages/enzyme-test-suite/test/_helpers/adapter.js @@ -27,6 +27,8 @@ if (process.env.ADAPTER) { Adapter = require('enzyme-adapter-react-16.3'); } else if (is('^16.4.0-0')) { Adapter = require('enzyme-adapter-react-16'); +} else if (is('^17')) { + Adapter = require('enzyme-adapter-react-17'); } module.exports = Adapter; diff --git a/packages/enzyme-test-suite/test/_helpers/react-compat.js b/packages/enzyme-test-suite/test/_helpers/react-compat.js index 900ad4c0b..08d9fc42c 100644 --- a/packages/enzyme-test-suite/test/_helpers/react-compat.js +++ b/packages/enzyme-test-suite/test/_helpers/react-compat.js @@ -36,7 +36,7 @@ let useRef; let useState; let act; -if (is('>=15.5 || ^16.0.0-alpha || ^16.3.0-alpha')) { +if (is('>=15.5 || ^16.0.0-alpha || ^16.3.0-alpha || ^17.0.0')) { // eslint-disable-next-line import/no-extraneous-dependencies createClass = require('create-react-class'); } else { @@ -50,7 +50,7 @@ if (is('^0.13.0')) { ({ renderToString } = require('react-dom/server')); } -if (is('^16.0.0-0 || ^16.3.0-0')) { +if (is('^16.0.0-0 || ^16.3.0-0 || ^17.0.0')) { ({ createPortal } = require('react-dom')); } else { createPortal = null; @@ -62,13 +62,13 @@ if (is('>=15.3')) { PureComponent = null; } -if (is('^16.2.0-0')) { +if (is('^16.2.0-0 || ^17.0.0')) { ({ Fragment } = require('react')); } else { Fragment = null; } -if (is('^16.3.0-0')) { +if (is('^16.3.0-0 || ^17.0.0')) { ({ createContext, createRef, @@ -84,7 +84,7 @@ if (is('^16.3.0-0')) { AsyncMode = null; } -if (is('^16.9.0-0')) { +if (is('^16.9.0-0 || ^17.0.0')) { ({ Profiler } = require('react')); } else if (is('^16.4.0-0')) { ({ @@ -94,7 +94,7 @@ if (is('^16.9.0-0')) { Profiler = null; } -if (is('^16.6.0-0')) { +if (is('^16.6.0-0 || ^17.0.0')) { ({ Suspense, lazy, @@ -122,7 +122,7 @@ if (is('^16.9.0-0')) { createRoot = null; } -if (is('^16.8.0-0')) { +if (is('^16.8.0-0 || ^17.0.0')) { ({ useCallback, useContext, diff --git a/packages/enzyme-test-suite/test/_helpers/version.js b/packages/enzyme-test-suite/test/_helpers/version.js index 5f2f37060..81f3ec88c 100644 --- a/packages/enzyme-test-suite/test/_helpers/version.js +++ b/packages/enzyme-test-suite/test/_helpers/version.js @@ -7,7 +7,8 @@ export function is(range) { if (/&&/.test(range)) { throw new RangeError('&& may not work properly in ranges, apparently'); } - return semver.satisfies(VERSION, range); + return semver.satisfies(VERSION, range, { includePrerelease: true }); } export const REACT16 = is('16'); +export const REACT17 = is('17');