From 0eeccf1b3bfe829985eac9219b1f8fefb0e031c3 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Tue, 17 Dec 2024 17:31:48 +0200 Subject: [PATCH] chore: fix N* tests (#33480) --- packages/fluentui/projects-test/assets/cra/src/index.tsx | 7 +++++++ packages/fluentui/projects-test/src/createReactApp.ts | 5 +++++ packages/fluentui/react-northstar/jest.config.js | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 packages/fluentui/projects-test/assets/cra/src/index.tsx diff --git a/packages/fluentui/projects-test/assets/cra/src/index.tsx b/packages/fluentui/projects-test/assets/cra/src/index.tsx new file mode 100644 index 0000000000000..b0ddfeee00e36 --- /dev/null +++ b/packages/fluentui/projects-test/assets/cra/src/index.tsx @@ -0,0 +1,7 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import App from './App'; + +const root = document.getElementById('root') as HTMLElement; + +ReactDOM.render(, root); diff --git a/packages/fluentui/projects-test/src/createReactApp.ts b/packages/fluentui/projects-test/src/createReactApp.ts index d8b81ba6e11ac..f926fe4b802f0 100644 --- a/packages/fluentui/projects-test/src/createReactApp.ts +++ b/packages/fluentui/projects-test/src/createReactApp.ts @@ -37,6 +37,11 @@ export async function createReactApp() { await addResolutionPathsForProjectPackages(testAppPathRoot); await shEcho(`yarn add ${packedPackages['@fluentui/react-northstar']}`, testAppPathRoot); + + // Enforce React 17 + const dependencies = ['@types/react@17', '@types/react-dom@17', 'react@17', 'react-dom@17'].join(' '); + await shEcho(`yarn add ${dependencies}`, tempPaths.testApp); + logger(`✔️ Fluent UI packages were added to dependencies`); logger("STEP 3. Reference Fluent UI components in test project's App.tsx"); diff --git a/packages/fluentui/react-northstar/jest.config.js b/packages/fluentui/react-northstar/jest.config.js index 5cdf12e0e8ac3..d873ab12d7231 100644 --- a/packages/fluentui/react-northstar/jest.config.js +++ b/packages/fluentui/react-northstar/jest.config.js @@ -10,6 +10,9 @@ const config = commonConfig({ // Legacy aliases, they should not be used in new tests ...getAliases(), }, + // Keeps Jest from using too much memory as GC gets invokes more often, makes tests slower + // https://stackoverflow.com/a/75857711 + workerIdleMemoryLimit: '1024MB', }); config.setupFilesAfterEnv = [...config.setupFilesAfterEnv, './jest-setup.js'];