Loading...
Loading...
Guides writing and running Vitest tests for Fusion Framework React apps with @equinor/fusion-framework-vitest-plugin-react-app — choosing a testing layer, configuring vitest.config.ts and Browser Mode, rendering with test/render/renderAppHook/renderAppComponent/testApp fixtures, and troubleshooting or migrating a suite. USE FOR: writing a new app/component/hook test, setting up vitest.config.ts for a Fusion app, choosing between app/framework/module/HTTP test layers, composing or overriding test fixtures, diagnosing a failing Fusion app test. DO NOT USE FOR: seeding module-specific mock state (auth, context, bookmarks, feature flags, HTTP) — use fusion-framework-mocking; dev-server-time API mocking/proxying (use fusion-developer-app); non-Fusion test suites; backend/service-repo tests.
npx skill4agent add equinor/fusion-skills fusion-framework-testingvitest.config.ts@equinor/fusion-framework-vitest-plugin-react-app/test/configvitest.config.tsuseAppModuleuseFrameworkfusion-framework-mockingdev-server.config.tsffc app devfusion-developer-appvitest.config.tsfusion-framework-mocking| Testing intent | Start with | Import |
|---|---|---|
| Pure function or framework-independent hook | Standard Vitest | |
| React hook that consumes app modules | | |
| React component, route, or complete app | | |
| Reusable app fixture without automatic app-file resolution | | |
| App module configuration without React | | see |
| Parent framework or portal-level modules | | see |
| One method call, timer, global, or JS module | Vitest's | |
references/getting-started-and-configuration.mdpnpm add -D vitest playwright @vitest/browser-playwright vitest-browser-react \
@equinor/fusion-framework-vitest-plugin-react-app
pnpm exec playwright install chromium// vitest.config.ts
import { defineProject } from '@equinor/fusion-framework-vitest-plugin-react-app/config';
export default defineProject();defineProjectappTestVitePluginsrc/**/*.{test,spec}.{ts,tsx}references/getting-started-and-configuration.mdimport { expect } from 'vitest';
import { test } from '@equinor/fusion-framework-vitest-plugin-react-app/test';
import { App } from './App';
test('renders the app', async ({ render }) => {
const screen = await render(<App />);
await expect.element(screen.getByRole('heading')).toBeVisible();
});awaitrenderrenderHookrenderAppComponentrenderAppHooktest/testtest.override(...)references/fixtures-and-advanced-usage.mdconfigureAppconfigureFusionmergeEnvConfigreferences/troubleshooting.mdappTestVitePluginhappy-domreferences/browser-mode-and-migration.mdhappy-domreferences/browser-mode-and-migration.md@testing-library/reactvitest.config.tsappTestVitePlugindefineProjectextendoverridefusion-framework-mocking@equinor/fusion-framework-vitest-plugin-react-app/testtestrenderrenderAppHookrenderAppComponenttestAppenvconfigurefusionserver.warmup.clientFilestest.include