Skip to content

Commit

Permalink
Split Jest configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Oct 11, 2024
1 parent d3bafe7 commit 9d1f3c8
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 92 deletions.
10 changes: 0 additions & 10 deletions packages/fuselage-hooks/jest.config.js

This file was deleted.

31 changes: 31 additions & 0 deletions packages/fuselage-hooks/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Config } from 'jest';

export default {
projects: [
{
displayName: 'server',
testEnvironment: 'node',
preset: 'ts-jest',
errorOnDeprecated: true,
testMatch: ['<rootDir>/src/**/*.server.spec.{ts,tsx}'],
setupFilesAfterEnv: [
'testing-utils/setup/noErrorsLogged',
'<rootDir>/src/jest-setup.ts',
],
},
{
displayName: 'client',
testEnvironment: 'jsdom',
preset: 'ts-jest',
errorOnDeprecated: true,
testMatch: [
'<rootDir>/src/**/*.spec.{ts,tsx}',
'!**/*.server.spec.{ts,tsx}',
],
setupFilesAfterEnv: [
'testing-utils/setup/noErrorsLogged',
'<rootDir>/src/jest-setup.ts',
],
},
],
} satisfies Config;
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useBorderBoxSize.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';
import { useRef } from 'react';

Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useClipboard.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useClipboard } from './useClipboard';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useContentBoxSize.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';
import { useRef } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useDebouncedCallback } from './useDebouncedCallback';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useDebouncedValue.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useDebouncedValue } from './useDebouncedValue';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useEffectEvent.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useEffectEvent } from './useEffectEvent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useLazyRef.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useLazyRef } from './useLazyRef';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useLocalStorage.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useLocalStorage } from './useStorage';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useMediaQueries.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useMediaQueries } from './useMediaQueries';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useMediaQuery.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useMediaQuery } from './useMediaQuery';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useMergedRefs.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';
import { createRef } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { usePrefersColorScheme } from './usePrefersColorScheme';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { usePrefersReducedData } from './usePrefersReducedData';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { usePrefersReducedMotion } from './usePrefersReducedMotion';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useResizeObserver.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useResizeObserver } from './useResizeObserver';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useSafely.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useSafely } from './useSafely';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useSessionStorage.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useSessionStorage } from './useStorage';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useToggle.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useToggle } from './useToggle';
Expand Down
4 changes: 0 additions & 4 deletions packages/fuselage-hooks/src/useUniqueId.server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { renderHook } from '@testing-library/react-hooks/server';

import { useUniqueId } from './useUniqueId';
Expand Down
4 changes: 2 additions & 2 deletions packages/fuselage-hooks/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"rootDirs": ["./src", "."],
"module": "ESNext",
"lib": ["DOM", "ES2015"],
"declarationDir": "./dist",
Expand All @@ -10,6 +10,6 @@
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["src"],
"include": ["src", "./jest.config.ts"],
"exclude": ["dist", "node_modules"]
}

0 comments on commit 9d1f3c8

Please sign in to comment.