File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @emotion/react ' : patch
3
+ ---
4
+
5
+ Do not warn about ` @emotion/react ` being loaded twice in Vitest as that might easily happen with mocked modules.
Original file line number Diff line number Diff line change
1
+ declare var vi: { }
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ export { default as css } from './css'
16
16
17
17
if ( process . env . NODE_ENV !== 'production' ) {
18
18
const isBrowser = typeof document !== 'undefined'
19
- // #1727 for some reason Jest evaluates modules twice if some consuming module gets mocked with jest.mock
20
- const isJest = typeof jest !== 'undefined'
19
+ // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
20
+ const isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined'
21
21
22
- if ( isBrowser && ! isJest ) {
22
+ if ( isBrowser && ! isTestEnv ) {
23
23
// globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
24
24
const globalContext =
25
25
// $FlowIgnore
You can’t perform that action at this time.
0 commit comments