Skip to content

Commit 0b93e9e

Browse files
committed
fix: restore cypress mount() support for passing providerProps
1 parent cf26cf3 commit 0b93e9e

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

cypress/support/setup/mount.js

Whitespace-only changes.

cypress/support/setup/mount.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import React, { ReactNode } from 'react';
10-
import { EuiProvider } from '../../../src';
10+
import { EuiProvider, EuiProviderProps } from '../../../src';
1111
import type { mount } from '@cypress/react18';
1212

1313
// Pick cypress mount function based on which React version is currently being
@@ -20,8 +20,16 @@ if (process.env.REACT_VERSION === '18') {
2020
cypressMount = require('@cypress/react').mount;
2121
}
2222

23-
const mountCommand = (children: ReactNode): ReturnType<typeof mount> => {
24-
return cypressMount(<EuiProvider>{children}</EuiProvider>);
23+
export interface MountOptions {
24+
providerProps?: Partial<EuiProviderProps<any>>;
25+
}
26+
27+
const mountCommand = (
28+
children: ReactNode,
29+
options: MountOptions = {}
30+
): ReturnType<typeof mount> => {
31+
const { providerProps } = options;
32+
return cypressMount(<EuiProvider {...providerProps}>{children}</EuiProvider>);
2533
};
2634

2735
// Export only the type to not confuse code-completion tools

0 commit comments

Comments
 (0)