create-lumen 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +5 -1
  2. package/package.json +8 -2
  3. package/src/configure.js +23 -13
  4. package/src/css.js +15 -3
  5. package/src/dependencies.js +8 -3
  6. package/src/format.js +28 -0
  7. package/src/injector.js +15 -4
  8. package/src/main.js +17 -1
  9. package/src/readme.js +1 -0
  10. package/templates/architectures/component-based/main.tsx +1 -1
  11. package/templates/architectures/component-based/src/App.jsx +0 -1
  12. package/templates/architectures/component-based/src/App.tsx +0 -1
  13. package/templates/architectures/component-based/src/components/common/Button.jsx +0 -2
  14. package/templates/architectures/component-based/src/components/common/Button.tsx +0 -2
  15. package/templates/architectures/component-based/src/config/constants.js +0 -1
  16. package/templates/architectures/component-based/src/config/constants.ts +0 -1
  17. package/templates/architectures/component-based/src/context/AppContext.jsx +3 -4
  18. package/templates/architectures/component-based/src/context/AppContext.tsx +11 -6
  19. package/templates/architectures/component-based/src/context/app-context.js +5 -0
  20. package/templates/architectures/component-based/src/context/app-context.ts +10 -0
  21. package/templates/architectures/component-based/src/hooks/useLocalStorage.ts +5 -5
  22. package/templates/architectures/component-based/src/layouts/MainLayout.jsx +0 -2
  23. package/templates/architectures/component-based/src/layouts/MainLayout.tsx +0 -2
  24. package/templates/architectures/component-based/src/pages/Home/Home.jsx +0 -1
  25. package/templates/architectures/component-based/src/pages/Home/Home.tsx +0 -1
  26. package/templates/architectures/component-based/src/utils/cn.ts +3 -1
  27. package/templates/architectures/feature-based/main.tsx +1 -1
  28. package/templates/architectures/feature-based/src/app/App.jsx +0 -1
  29. package/templates/architectures/feature-based/src/app/App.tsx +0 -1
  30. package/templates/architectures/feature-based/src/app/providers/ThemeProvider.jsx +0 -2
  31. package/templates/architectures/feature-based/src/app/providers/ThemeProvider.tsx +2 -2
  32. package/templates/architectures/feature-based/src/components/ui/Button.jsx +0 -2
  33. package/templates/architectures/feature-based/src/components/ui/Button.tsx +0 -2
  34. package/templates/architectures/feature-based/src/config/constants.js +0 -1
  35. package/templates/architectures/feature-based/src/config/constants.ts +0 -1
  36. package/templates/architectures/feature-based/src/features/home/pages/HomePage.jsx +0 -1
  37. package/templates/architectures/feature-based/src/features/home/pages/HomePage.tsx +0 -1
  38. package/templates/architectures/feature-based/src/hooks/useLocalStorage.ts +5 -5
  39. package/templates/architectures/feature-based/src/utils/cn.ts +3 -4
  40. package/templates/conditional/formatter/oxfmt/.oxfmtrc.json +1 -1
  41. package/templates/conditional/formatter/prettier/.prettierrc +2 -2
  42. package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.jsx +5 -5
  43. package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.tsx +5 -5
  44. package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.jsx +5 -5
  45. package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.tsx +5 -5
  46. package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.jsx +2 -3
  47. package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.tsx +2 -3
  48. package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx +2 -3
  49. package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx +2 -3
  50. package/templates/conditional/linting/eslint/eslint.config.js +24 -2
  51. package/templates/conditional/linting/eslint/eslint.config.ts +25 -2
  52. package/templates/conditional/router/component-based/src/App.jsx +0 -1
  53. package/templates/conditional/router/component-based/src/App.tsx +0 -1
  54. package/templates/conditional/router/component-based/src/routes/index.jsx +0 -1
  55. package/templates/conditional/router/component-based/src/routes/index.tsx +0 -1
  56. package/templates/conditional/router/feature-based/src/app/App.jsx +0 -1
  57. package/templates/conditional/router/feature-based/src/app/App.tsx +0 -1
  58. package/templates/conditional/state/redux/component-based/src/context/StoreProvider.jsx +0 -1
  59. package/templates/conditional/state/redux/component-based/src/context/StoreProvider.tsx +2 -2
  60. package/templates/conditional/state/redux/component-based/src/pages/Home/counterSlice.ts +9 -3
  61. package/templates/conditional/state/redux/component-based/src/store/hooks.ts +4 -2
  62. package/templates/conditional/state/redux/component-based/src/store/index.ts +2 -2
  63. package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.jsx +0 -1
  64. package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.tsx +2 -2
  65. package/templates/conditional/state/redux/feature-based/src/features/home/store/counterSlice.ts +9 -3
  66. package/templates/conditional/state/redux/feature-based/src/stores/hooks.ts +4 -2
  67. package/templates/conditional/state/redux/feature-based/src/stores/index.ts +2 -2
  68. package/templates/conditional/state/zustand/component-based/src/store/useCounterStore.ts +8 -1
  69. package/templates/conditional/state/zustand/feature-based/src/stores/useCounterStore.ts +8 -1
  70. package/templates/conditional/testing/jest/babel.config.cjs +7 -0
  71. package/templates/conditional/testing/jest/component-based/src/__tests__/App.test.jsx +10 -0
  72. package/templates/conditional/testing/jest/component-based/src/__tests__/App.test.tsx +11 -0
  73. package/templates/conditional/testing/jest/{src → feature-based/src}/__tests__/App.test.jsx +2 -1
  74. package/templates/conditional/testing/jest/feature-based/src/__tests__/App.test.tsx +11 -0
  75. package/templates/conditional/testing/jest/jest.config.js +2 -3
  76. package/templates/conditional/testing/jest/jest.config.ts +6 -4
  77. package/templates/conditional/testing/jest/jest.setup.js +6 -0
  78. package/templates/conditional/testing/jest/jest.setup.ts +6 -0
  79. package/templates/conditional/testing/vitest/component-based/src/__tests__/App.test.jsx +10 -0
  80. package/templates/conditional/testing/{jest → vitest/component-based}/src/__tests__/App.test.tsx +2 -1
  81. package/templates/architectures/component-based/src/routes/index.jsx +0 -11
  82. package/templates/architectures/component-based/src/routes/index.tsx +0 -11
  83. /package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.jsx +0 -0
  84. /package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.tsx +0 -0
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "@hugeicons/react";
1
+ import { HugeiconsIcon } from "@hugeicons/react";
2
+ import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
3
3
  import { Button } from "@/components/common";
4
4
 
5
5
  export function HomePage() {
6
6
  return (
7
7
  <div className="text-center">
8
8
  <div className="flex justify-center gap-4 mb-6">
9
- <Sun className="w-8 h-8 text-yellow-500" />
10
- <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
9
+ <HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
10
+ <HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
11
+ <HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
12
12
  </div>
13
13
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
14
  <p className="text-gray-600 mb-8">
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "@hugeicons/react";
1
+ import { HugeiconsIcon } from "@hugeicons/react";
2
+ import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
3
3
  import { Button } from "@/components/ui";
4
4
 
5
5
  export function HomePage() {
6
6
  return (
7
7
  <div className="text-center">
8
8
  <div className="flex justify-center gap-4 mb-6">
9
- <Sun className="w-8 h-8 text-yellow-500" />
10
- <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
9
+ <HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
10
+ <HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
11
+ <HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
12
12
  </div>
13
13
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
14
  <p className="text-gray-600 mb-8">
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "@hugeicons/react";
1
+ import { HugeiconsIcon } from "@hugeicons/react";
2
+ import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
3
3
  import { Button } from "@/components/ui";
4
4
 
5
5
  export function HomePage() {
6
6
  return (
7
7
  <div className="text-center">
8
8
  <div className="flex justify-center gap-4 mb-6">
9
- <Sun className="w-8 h-8 text-yellow-500" />
10
- <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
9
+ <HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
10
+ <HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
11
+ <HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
12
12
  </div>
13
13
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
14
  <p className="text-gray-600 mb-8">
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "lucide-react";
1
+ import { Sun, Moon, GitBranch } from "lucide-react";
3
2
  import { Button } from "@/components/common";
4
3
 
5
4
  export function HomePage() {
@@ -8,7 +7,7 @@ export function HomePage() {
8
7
  <div className="flex justify-center gap-4 mb-6">
9
8
  <Sun className="w-8 h-8 text-yellow-500" />
10
9
  <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
10
+ <GitBranch className="w-8 h-8 text-gray-800" />
12
11
  </div>
13
12
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
13
  <p className="text-gray-600 mb-8">
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "lucide-react";
1
+ import { Sun, Moon, GitBranch } from "lucide-react";
3
2
  import { Button } from "@/components/common";
4
3
 
5
4
  export function HomePage() {
@@ -8,7 +7,7 @@ export function HomePage() {
8
7
  <div className="flex justify-center gap-4 mb-6">
9
8
  <Sun className="w-8 h-8 text-yellow-500" />
10
9
  <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
10
+ <GitBranch className="w-8 h-8 text-gray-800" />
12
11
  </div>
13
12
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
13
  <p className="text-gray-600 mb-8">
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "lucide-react";
1
+ import { Sun, Moon, GitBranch } from "lucide-react";
3
2
  import { Button } from "@/components/ui";
4
3
 
5
4
  export function HomePage() {
@@ -8,7 +7,7 @@ export function HomePage() {
8
7
  <div className="flex justify-center gap-4 mb-6">
9
8
  <Sun className="w-8 h-8 text-yellow-500" />
10
9
  <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
10
+ <GitBranch className="w-8 h-8 text-gray-800" />
12
11
  </div>
13
12
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
13
  <p className="text-gray-600 mb-8">
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { Sun, Moon, Github } from "lucide-react";
1
+ import { Sun, Moon, GitBranch } from "lucide-react";
3
2
  import { Button } from "@/components/ui";
4
3
 
5
4
  export function HomePage() {
@@ -8,7 +7,7 @@ export function HomePage() {
8
7
  <div className="flex justify-center gap-4 mb-6">
9
8
  <Sun className="w-8 h-8 text-yellow-500" />
10
9
  <Moon className="w-8 h-8 text-blue-500" />
11
- <Github className="w-8 h-8 text-gray-800" />
10
+ <GitBranch className="w-8 h-8 text-gray-800" />
12
11
  </div>
13
12
  <h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
14
13
  <p className="text-gray-600 mb-8">
@@ -4,11 +4,12 @@ import reactHooks from "eslint-plugin-react-hooks";
4
4
  import reactRefresh from "eslint-plugin-react-refresh";
5
5
 
6
6
  export default [
7
+ js.configs.recommended,
7
8
  { ignores: ["dist"] },
8
9
  {
9
10
  files: ["**/*.{js,jsx}"],
10
11
  languageOptions: {
11
- ecmaVersion: 2020,
12
+ ecmaVersion: "latest",
12
13
  globals: globals.browser,
13
14
  parserOptions: {
14
15
  ecmaVersion: "latest",
@@ -28,4 +29,25 @@ export default [
28
29
  ],
29
30
  },
30
31
  },
31
- ];
32
+ {
33
+ // Node-runtime files: Vite/Vitest/Jest/ESLint configs and CLI scripts.
34
+ files: [
35
+ "**/*.config.{js,cjs,mjs}",
36
+ "eslint.config.js",
37
+ "scripts/**/*.{js,mjs}",
38
+ "jest.setup.{js,mjs}",
39
+ ],
40
+ languageOptions: {
41
+ ecmaVersion: "latest",
42
+ globals: globals.node,
43
+ },
44
+ },
45
+ {
46
+ // Test files also see Jest globals (Vitest suites import explicitly).
47
+ files: ["**/*.test.{js,jsx}"],
48
+ languageOptions: {
49
+ ecmaVersion: "latest",
50
+ globals: { ...globals.browser, ...globals.jest },
51
+ },
52
+ },
53
+ ];
@@ -10,7 +10,7 @@ export default tseslint.config(
10
10
  extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
11
  files: ["**/*.{ts,tsx}"],
12
12
  languageOptions: {
13
- ecmaVersion: 2020,
13
+ ecmaVersion: "latest",
14
14
  globals: globals.browser,
15
15
  },
16
16
  plugins: {
@@ -24,5 +24,28 @@ export default tseslint.config(
24
24
  { allowConstantExport: true },
25
25
  ],
26
26
  },
27
+ },
28
+ {
29
+ // Node-runtime files: Vite/Vitest/Jest/ESLint configs and CLI scripts.
30
+ extends: [...tseslint.configs.recommended],
31
+ files: [
32
+ "**/*.config.{ts,mts}",
33
+ "eslint.config.ts",
34
+ "scripts/**/*.{ts,mts}",
35
+ "jest.setup.ts",
36
+ ],
37
+ languageOptions: {
38
+ ecmaVersion: "latest",
39
+ globals: globals.node,
40
+ },
41
+ },
42
+ {
43
+ // Test files also see Jest globals (Vitest suites import explicitly).
44
+ extends: [...tseslint.configs.recommended],
45
+ files: ["**/*.test.{ts,tsx}"],
46
+ languageOptions: {
47
+ ecmaVersion: "latest",
48
+ globals: { ...globals.browser, ...globals.jest },
49
+ },
27
50
  }
28
- );
51
+ );
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { MainLayout } from "@/layouts/MainLayout";
3
2
  import { AppRoutes } from "@/routes";
4
3
 
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { MainLayout } from "@/layouts/MainLayout";
3
2
  import { AppRoutes } from "@/routes";
4
3
 
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { BrowserRouter, Routes, Route } from "react-router-dom";
3
2
  import { HomePage } from "@/pages/Home";
4
3
 
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { BrowserRouter, Routes, Route } from "react-router-dom";
3
2
  import { HomePage } from "@/pages/Home";
4
3
 
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { AppRouter } from "./router";
3
2
 
4
3
  export default function App() {
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { AppRouter } from "./router";
3
2
 
4
3
  export default function App() {
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { Provider } from "react-redux";
3
2
  import { store } from "@/store";
4
3
 
@@ -1,7 +1,7 @@
1
- import React from "react";
1
+ import type { ReactNode } from "react";
2
2
  import { Provider } from "react-redux";
3
3
  import { store } from "@/store";
4
4
 
5
- export function StoreProvider({ children }) {
5
+ export function StoreProvider({ children }: { children: ReactNode }) {
6
6
  return <Provider store={store}>{children}</Provider>;
7
7
  }
@@ -1,8 +1,14 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
2
+
3
+ interface CounterState {
4
+ value: number;
5
+ }
6
+
7
+ const initialState: CounterState = { value: 0 };
2
8
 
3
9
  const counterSlice = createSlice({
4
10
  name: "counter",
5
- initialState: { value: 0 },
11
+ initialState,
6
12
  reducers: {
7
13
  increment: (state) => {
8
14
  state.value += 1;
@@ -10,7 +16,7 @@ const counterSlice = createSlice({
10
16
  decrement: (state) => {
11
17
  state.value -= 1;
12
18
  },
13
- incrementByAmount: (state, action) => {
19
+ incrementByAmount: (state, action: PayloadAction<number>) => {
14
20
  state.value += action.payload;
15
21
  },
16
22
  },
@@ -1,4 +1,6 @@
1
1
  import { useDispatch, useSelector } from "react-redux";
2
+ import type { TypedUseSelectorHook } from "react-redux";
3
+ import type { RootState, AppDispatch } from "./index";
2
4
 
3
- export const useAppDispatch = useDispatch;
4
- export const useAppSelector = useSelector;
5
+ export const useAppDispatch: () => AppDispatch = useDispatch;
6
+ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
@@ -7,5 +7,5 @@ export const store = configureStore({
7
7
  },
8
8
  });
9
9
 
10
- export const RootState = store.getState;
11
- export const AppDispatch = store.dispatch;
10
+ export type RootState = ReturnType<typeof store.getState>;
11
+ export type AppDispatch = typeof store.dispatch;
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { Provider } from "react-redux";
3
2
  import { store } from "@/stores";
4
3
 
@@ -1,7 +1,7 @@
1
- import React from "react";
1
+ import type { ReactNode } from "react";
2
2
  import { Provider } from "react-redux";
3
3
  import { store } from "@/stores";
4
4
 
5
- export function StoreProvider({ children }) {
5
+ export function StoreProvider({ children }: { children: ReactNode }) {
6
6
  return <Provider store={store}>{children}</Provider>;
7
7
  }
@@ -1,8 +1,14 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
2
+
3
+ interface CounterState {
4
+ value: number;
5
+ }
6
+
7
+ const initialState: CounterState = { value: 0 };
2
8
 
3
9
  const counterSlice = createSlice({
4
10
  name: "counter",
5
- initialState: { value: 0 },
11
+ initialState,
6
12
  reducers: {
7
13
  increment: (state) => {
8
14
  state.value += 1;
@@ -10,7 +16,7 @@ const counterSlice = createSlice({
10
16
  decrement: (state) => {
11
17
  state.value -= 1;
12
18
  },
13
- incrementByAmount: (state, action) => {
19
+ incrementByAmount: (state, action: PayloadAction<number>) => {
14
20
  state.value += action.payload;
15
21
  },
16
22
  },
@@ -1,4 +1,6 @@
1
1
  import { useDispatch, useSelector } from "react-redux";
2
+ import type { TypedUseSelectorHook } from "react-redux";
3
+ import type { RootState, AppDispatch } from "./index";
2
4
 
3
- export const useAppDispatch = useDispatch;
4
- export const useAppSelector = useSelector;
5
+ export const useAppDispatch: () => AppDispatch = useDispatch;
6
+ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
@@ -7,5 +7,5 @@ export const store = configureStore({
7
7
  },
8
8
  });
9
9
 
10
- export const RootState = store.getState;
11
- export const AppDispatch = store.dispatch;
10
+ export type RootState = ReturnType<typeof store.getState>;
11
+ export type AppDispatch = typeof store.dispatch;
@@ -1,6 +1,13 @@
1
1
  import { create } from "zustand";
2
2
 
3
- export const useCounterStore = create((set) => ({
3
+ interface CounterState {
4
+ count: number;
5
+ increment: () => void;
6
+ decrement: () => void;
7
+ incrementByAmount: (amount: number) => void;
8
+ }
9
+
10
+ export const useCounterStore = create<CounterState>()((set) => ({
4
11
  count: 0,
5
12
  increment: () => set((state) => ({ count: state.count + 1 })),
6
13
  decrement: () => set((state) => ({ count: state.count - 1 })),
@@ -1,6 +1,13 @@
1
1
  import { create } from "zustand";
2
2
 
3
- export const useCounterStore = create((set) => ({
3
+ interface CounterState {
4
+ count: number;
5
+ increment: () => void;
6
+ decrement: () => void;
7
+ incrementByAmount: (amount: number) => void;
8
+ }
9
+
10
+ export const useCounterStore = create<CounterState>()((set) => ({
4
11
  count: 0,
5
12
  increment: () => set((state) => ({ count: state.count + 1 })),
6
13
  decrement: () => set((state) => ({ count: state.count - 1 })),
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ presets: [
3
+ ["@babel/preset-env", { targets: { node: "current" } }],
4
+ ["@babel/preset-react", { runtime: "automatic" }],
5
+ ["@babel/preset-typescript"],
6
+ ],
7
+ };
@@ -0,0 +1,10 @@
1
+ import { describe, it, expect } from "@jest/globals";
2
+ import { render, screen } from "@testing-library/react";
3
+ import App from "@/App";
4
+
5
+ describe("App", () => {
6
+ it("renders without crashing", () => {
7
+ render(<App />);
8
+ expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
9
+ });
10
+ });
@@ -0,0 +1,11 @@
1
+ import { describe, it, expect } from "@jest/globals";
2
+ import { render, screen } from "@testing-library/react";
3
+ import "@testing-library/jest-dom/jest-globals";
4
+ import App from "@/App";
5
+
6
+ describe("App", () => {
7
+ it("renders without crashing", () => {
8
+ render(<App />);
9
+ expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
10
+ });
11
+ });
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "@jest/globals";
1
2
  import { render, screen } from "@testing-library/react";
2
3
  import App from "@/app/App";
3
4
 
@@ -6,4 +7,4 @@ describe("App", () => {
6
7
  render(<App />);
7
8
  expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
8
9
  });
9
- });
10
+ });
@@ -0,0 +1,11 @@
1
+ import { describe, it, expect } from "@jest/globals";
2
+ import { render, screen } from "@testing-library/react";
3
+ import "@testing-library/jest-dom/jest-globals";
4
+ import App from "@/app/App";
5
+
6
+ describe("App", () => {
7
+ it("renders without crashing", () => {
8
+ render(<App />);
9
+ expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
10
+ });
11
+ });
@@ -1,5 +1,4 @@
1
- /** @type {import('jest').Config} */
2
- module.exports = {
1
+ export default {
3
2
  testEnvironment: "jsdom",
4
3
  roots: ["<rootDir>/src"],
5
4
  setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
@@ -9,4 +8,4 @@ module.exports = {
9
8
  transform: {
10
9
  "^.+\\.jsx?$": "babel-jest",
11
10
  },
12
- };
11
+ };
@@ -1,6 +1,6 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- module.exports = {
3
- preset: "ts-jest",
1
+ import type { Config } from "jest";
2
+
3
+ const config: Config = {
4
4
  testEnvironment: "jsdom",
5
5
  roots: ["<rootDir>/src"],
6
6
  setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
@@ -8,6 +8,8 @@ module.exports = {
8
8
  "^@/(.*)$": "<rootDir>/src/$1",
9
9
  },
10
10
  transform: {
11
- "^.+\\.tsx?$": "ts-jest",
11
+ "^.+\\.tsx?$": "babel-jest",
12
12
  },
13
13
  };
14
+
15
+ export default config;
@@ -1 +1,7 @@
1
1
  import "@testing-library/jest-dom";
2
+ import { TextDecoder, TextEncoder } from "node:util";
3
+
4
+ // react-router (and other modern libs) reference TextEncoder/TextDecoder at
5
+ // module scope; jest's jsdom runner does not expose Node's globals by default.
6
+ globalThis.TextEncoder = TextEncoder;
7
+ globalThis.TextDecoder = TextDecoder;
@@ -1 +1,7 @@
1
1
  import "@testing-library/jest-dom";
2
+ import { TextDecoder, TextEncoder } from "node:util";
3
+
4
+ // react-router (and other modern libs) reference TextEncoder/TextDecoder at
5
+ // module scope; jest's jsdom runner does not expose Node's globals by default.
6
+ globalThis.TextEncoder = TextEncoder;
7
+ globalThis.TextDecoder = TextDecoder;
@@ -0,0 +1,10 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import { describe, it, expect } from "vitest";
3
+ import App from "@/App";
4
+
5
+ describe("App", () => {
6
+ it("renders without crashing", () => {
7
+ render(<App />);
8
+ expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
9
+ });
10
+ });
@@ -1,5 +1,6 @@
1
1
  import { render, screen } from "@testing-library/react";
2
- import App from "@/app/App";
2
+ import { describe, it, expect } from "vitest";
3
+ import App from "@/App";
3
4
 
4
5
  describe("App", () => {
5
6
  it("renders without crashing", () => {
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { Routes, Route } from "react-router-dom";
3
- import { HomePage } from "@/pages/Home";
4
-
5
- export function AppRoutes() {
6
- return (
7
- <Routes>
8
- <Route path="/" element={<HomePage />} />
9
- </Routes>
10
- );
11
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { Routes, Route } from "react-router-dom";
3
- import { HomePage } from "@/pages/Home";
4
-
5
- export function AppRoutes() {
6
- return (
7
- <Routes>
8
- <Route path="/" element={<HomePage />} />
9
- </Routes>
10
- );
11
- }