Skip to content

Commit

Permalink
Use react@17 for useSyncExternalStore shim tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Jan 23, 2024
1 parent e1d20fc commit 808b4e7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/use-sync-external-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
"license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"react-17": "npm:react@^17",
"react-dom-17": "npm:react-dom@^17"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
// eslint-disable-next-line no-unused-vars
useSyncExternalStore: __,
...otherExports
} = jest.requireActual('react');
} = jest.requireActual('react-17/umd/react.development.js');
return otherExports;
});

jest.mock('react-dom', () =>
jest.requireActual('react-dom-17/umd/react-dom.development.js'),
);
}

React = require('react');
Expand Down Expand Up @@ -594,6 +598,8 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
);
}).toErrorDev(
'The result of getSnapshot should be cached to avoid an infinite loop',
// Stacks don't work when we're using the npm package
{withoutStack: gate(flags => flags.enableUseSyncExternalStoreShim)},
);
});

Expand Down
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12838,6 +12838,14 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.8:
prop-types "^15.6.2"
scheduler "^0.13.0"

"react-17@npm:react@^17":
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

"react-dom-15@npm:react-dom@^15":
version "15.6.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.2.tgz#41cfadf693b757faf2708443a1d1fd5a02bef730"
Expand All @@ -12858,6 +12866,15 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.8:
prop-types "^15.6.2"
scheduler "^0.13.0"

"react-dom-17@npm:react-dom@^17":
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"

react-is@^16.8.1, react-is@^17.0.1, "react-is@npm:react-is":
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
Expand Down Expand Up @@ -13524,6 +13541,14 @@ scheduler@^0.13.0:
loose-envify "^1.1.0"
object-assign "^4.1.1"

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"
Expand Down

0 comments on commit 808b4e7

Please sign in to comment.